Photo by National Cancer Institute on Unsplash

The reason why I build this Game of Life example is because an interview. That’s really interesting because the leetcode also has this problem (289. Game of Life). So I try to use a brute force solution to get the next state. Then follow the Android MVP pattern to build the app.


Image source from here

The performance/memory tuning is a huge topic in engineer world. In order to delight our user to make a good UX. We always need to think about how to improve our application no matter in memory management and performance. One of thing we can do is how to accelerate the network request call. There are some data format for communication between client and server: such as xml, JSON in http and gRPC in http/2. In this article I want to introduce alternative way — FlatBuffer.

Why flatbuffer?

FlatBuffer is an efficient cross platform serialization library. It will flat our data in a…


What’s the reverse engineering? Here is the definition from Wiki.

Reverse engineering, also called back engineering, is the process by which a man-made object is deconstructed to reveal its designs, architecture, or to extract knowledge from the object; similar to scientific research, the only difference being that scientific research is about a natural phenomenon.

As an android programer, you might interest with how does the app feature works or what kind of library they using. Or you want to find out the architectures/components of the app under the hood. Then we can try to extract the app source to check…


Paint by Chris

Flutter community icon is quite cute. So I was thinking about how it draw in flutter. The first method cross my mind is that using the heart shape. And i did it but it doesn’t like the community shape at all…


Photo from raywenderlich
  1. and && is a bit different in boolean check. For example:
val a = 3
val b = 4
val c = 5
val d = 3

val result1 = b == c && a == d

val result2 = (b == c) and (a == d)

You cannot write result2 to val result2 = b == c and a == d . Because operator precedence is not working for this case. It will look like val result2 = ((b == c) and a) == d . The difference between and && in boolean check is in result1 b ==…


Photo from ddstax

The tax id number is different for each country. Here I want to show you how to check a tax id is valid or not. (Example is Taiwan rule.)

Here is the rule of the TW tax id:

Let's say the tax id is A B C D E F G H
A — G representer each number from 0~9, H is checksum.
A — G will multiply by specific value, if the outcome more than 10. You need add the units digit and ten digit.
A x 1
B x 2
C x 1
D x 2
E x 1
F x 2
G x 4
H x 1
Finally…

Google prohibits the SMS/CALL_LOG related permission if your app is not mainly for the phone call, text purpose. Or you cannot send the updated app via Google Play anymore. But for some app, we need to verify the user’s account via their phone. And in the user’s perspective, we should make it as much as easier to do.

There is an alternative way— SMS Retrieve API

1. You need to add one auth dependency.

dependencies {
//... skip above dependencies
"com.google.android.gms:play-services-auth:17.0.0"
}

2. Add request hint to your Activity or Fragment. The best way is to use the hint picker…


Android Q

Android official website provides a page to introduce how to migrate your existing project to AndroidX. Here is my migration step.

1. You have to add these two attrs in your gradle.properties

android.useAndroidX=true
android.enableJetifier=true

2. Update your compileSdkVersion, targetSdkVersion to 28. Like the below example.

compileSdkVersion 28
defaultConfig {
applicationId "com.your.package"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.support.test.runner.AndroidJUnitRunner"
}

3. upgrade your dependencies to the AndroidX newest. For dependencies, the version can refer to maven.

4. You need to modify your layout and .java/.kt since the package name is using AndroidX for now. Like:

android.support.constraint.ConstraintLayout => androidx.constraintlayout.widget.ConstraintLayout


Photo by Dan Price on Makeuseof

Android launch Data Binding library for several years. The Data Binding Library offers both flexibility and broad compatibility. You can use it with devices running Android 4.0 (API level 14) or higher. It’s an option to apply since we still can use the local way to write our code. So what’s the benefit to apply it to our project? I would say. It will let our code clean. Let’s see how we implement it.

In build.gradle we can easily enable it by a toggle.

apply plugin: 'kotlin-kapt'android {
... …

Chris Chen

An Android developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store