Very interesting topic…
It’s important as Android will display an “Application not responding” (ANR) dialog if an activities does not react within 5 seconds. From this dialog the user can choose to stop the application.
Therefore all potentially slow running operations in an Android application should run in the background, e.g. via some way of concurrency constructs of the Java language or the Android framework. Potential slow operations are network, file and database access but also complex calculations.
Tutorial from the link below will teach how to use and handle the background processing….