Avoiding too frequent updates to the views

In Android in order to avoid to do too work in the main thread, most of the operations should be carried out in a secondary thread or a class that extends AsyncTask; then the final results are reported in some view to be shown to the user using Activity.runOnUiThread(Runnable) or View.post(Runnable) (see Processes and Threads) […]

Read More →

Restoring complex objects at restart of an activity

In an android app an activity is created and then destroyed, for example when the user open another activity or when the user presses the back button, later the user opens again the same activity that is is recreated using the data saved before the earlier destruction of the activity. The data are saved in […]

Read More →

Stopping the threads

Starting a thread is very easy in java, after you create it you need to call the method start(), for example:

where MyRunnable is a class implementing the Runnable interface overidden the method run().

Read More →