Skip to content

Instantly share code, notes, and snippets.

Avatar
😀
Working on Android Apps

Jonathan Mercandalli Mercandj

😀
Working on Android Apps
View GitHub Profile
@Mercandj
Mercandj / setup_mac_os.md
Last active Sep 14, 2020
"Minimal" setup to work on MacOS as an Android Developer
View setup_mac_os.md

Mac OS Setup

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

@Mercandj
Mercandj / developer_principles.md
Last active Sep 26, 2020
I'm your CTO! As a developer, here the rules I expect you to follow:
View developer_principles.md

Developer: Principles

Description

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
Mercandj / android_livedata.md
Last active Aug 30, 2020
LiveData: Pros, Cons, Conclusion.
View android_livedata.md

Android: LiveData

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

class Timer {

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

Android view: Layout IDs creation

Issue:

Here a ConstraintLayout in a layout containing 2 views:

<androidx.constraintlayout.widget.ConstraintLayout>

    <View
@Mercandj
Mercandj / android_upload_aab.md
Last active Aug 10, 2020
Android: Upload AppBundle on the PlayStore via CLI
View android_upload_aab.md

Android: Upload AppBundle on PlayStore

Goal:

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

Process:

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

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
View immutable_list.md

Immutable lists

Introduction

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".

View android_application_initialization.md

Android: Application initialization

On Android, there is a common issue that developers must solve: Deal with heavy load at application start.

1. Application.onCreate()

The easier solution is to put the initialization on the Application

class MainApplication: Application() {
@Mercandj
Mercandj / android_asynchronous.md
Last active Jun 26, 2020
android_asynchronous
View android_asynchronous.md

Android: Asynchronous

  • This document is to highlight some way to work with asynchronous method on Android.
  • Not vocation to be exhaustive and explicit
  • The goal is for you to pick the good one.

0/ Setup

All following technics will use this setup: methods and interface.

View opus_android.sh
#!/bin/bash
# Parameters: nothing
# Required `$ANDROID_NDK` in your path. For example /Users/jonathan/Library/Android/sdk/ndk-bundle
# Script to generate pre-build opus files
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
if [ -z "$ANDROID_NDK" ]; then
echo "Please set ANDROID_NDK to the Android NDK folder"
You can’t perform that action at this time.