Tag: thread

  • 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)…

  • Stopping the threads

    Starting a thread is very easy in java, after you create it you need to call the method start(), for example: Thread myThread = new Thread(new MyRunnable()); myThread.start(); where MyRunnable is a class implementing the Runnable interface overidden the method run().

  • Updating frequently a TextView inside a loop

    The problem How to update a TextView inside a loop or, more generally, how to update frequently an UI element of an Activity.