Keeping your application responsive

How many times has it happened to you that you use some Android application and get the message saying that the application is not responding? Why does this happen? We will explain! Pay attention to these points so you don't have the same thing happening with your application:

  • Make sure nothing blocks your input (any intensive operation, especially network traffic).
  • Don't perform long tasks on the main application thread.
  • Don't perform long running operations in the onReceive() method for your broadcast receivers.
  • Make use of the AsyncTask class as much as you can. Consider the use of ThreadPoolExecutor.
  • Try using content loaders whenever it's possible.
  • Avoid executing too many threads at the same time. ...

Get Mastering Android Development with Kotlin now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.