Android Performance Checking and Solving(3): Tips No Tricks

ade sueb
2 min readAug 4, 2020

Multi Thread and Performance Tools

Tips #1 Multi Thread

Choose the right Thread :

  • IO Thread -> IO Process, Read/Write Disk and Network Process
  • Computation Thread ->For complex algorithm, calculation, or long process
  • Main Thread -> Leave it for UI Showing or Changes.

Choose the right Api for changing Thread:

  • Runnable -> simple changing Thread for leave and forget process.
  • AsyncTask -> simple changing Thread and back to UI Thread.
  • RXJava -> changing Thread multiple times in 1 process call.

Android has provided some good tips regarding performance, you can take a look at this. This story has some different tips other than Android has provided.

Tips #2 Tools

Just like some super heroes have weapon. We need some weapons or tools to help us kill performance issues.

Firebase Performance

This tools is very use full. You can trace Network, CPU, App Start Duration, Slow Rendering and many more.

The data is huge. Because the data got from real users. More Number of user you have, more data you got.

Android Studio Profiler (CPU Profiler)

I like the CPU Profiler, because i can measure the duration of some methods call. And i can trace the longest methods call that disturb UI Thread.

And if you want to automatically do profiling while your app is running without attach to Android Studio Profiler you can use Debug APi. Record automatically and simply export the result to Android Studio Profiler.