Skip to content

Instantly share code, notes, and snippets.

Working on Android Apps

Jonathan Mercandalli Mercandj

Working on Android Apps
View GitHub Profile

Manager: Principles

Imagine you are a tech manager, as a tech manager here some principles:


# 5 Principles
1 Promote your CTO principles about code
2 Lead by example
Mercandj /
Last active Nov 2, 2020
Derivation of images into Android drawable folders
# Convert images png or jpg into Android drawable folder and convert into webp
# · Setup: "brew install imagemagick" //
# · Place your images in the same folder of this script
# · Run the script

Gitlab runner setup (CI)

  • Install brew
  • Install gitlab runner with brew install gitlab-runner
  • Install gitlab as a start server brew services start gitlab-runner
  • Be sure to have unregister previous runner sudo gitlab-runner unregister --all-runners
  • Configure the runner sudo gitlab-runner register
    • Typer the URL of gitlab (cf in the WebApp, YourProject > Settings > CI/CD)
    • Typer the Token of gitlab (cf in the WebApp, YourProject > Settings > CI/CD)
    • Tag (for example "android")
Mercandj /
Last active Jan 9, 2021
"Minimal" setup to work on MacOS as an Android Developer

Mac OS Setup

Here my "minimal" setup to work on a Mac as an Android Developer

Mercandj /
Last active Apr 11, 2021
I'm your CTO! As a developer, here the rules I expect you to follow:

Developer: Principles


Like Robert C. Martin would say on this video,

Imagine I'm your CTO, as your CTO I expect you to follow this principles:

Untitled-collage-10-min-9 (1)

Mercandj /
Last active Aug 30, 2020
LiveData: Pros, Cons, Conclusion.

Android: LiveData

Pros, Cons, Conclusion. TLDR; More Cons than Pros.

class Timer {

   private val timeLeftMillis = MutableLiveData(5_000L)
   fun getTimeLeftMillis(): LiveData<Long> {

Android view: Layout IDs creation


Here a ConstraintLayout in a layout containing 2 views:


Mercandj /
Last active Aug 10, 2020
Android: Upload AppBundle on the PlayStore via CLI

Android: Upload AppBundle on PlayStore


Upload AppBundle on the PlayStore via the termial. Based on the Google API Publisher v3.


  • Be sure to have Java installed
  • Be sure to have your AppBundle file .aab

Android: Activity restoration

When you user click Home on any of your activity, the system will save the state of the activity stack and the state of your top-activity.

Then, when your user go back to your application, this activity and the activities stack will be restored on a new JVM.

How to test it?

  • Open your app
  • Go to the activity you want to test

Immutable lists


Immutable lists can be misleading. Here I will use Kotlin. This snippet is viable on Java, C#, Swift... too.

I'm assuming you understand why immutable objects are "more robust" to manipulate data.

Here a "book" with "pages".