Android Handler Example
In this example we will see how to use Handler in android. This example downloads image from server and using Handler it is communicating back with UI thread. A Handler allows you communicate back with the UI thread from other background thread. This is useful in android as android doesn’t allow other threads to communicate directly with UI thread. Handler can send and process Message and Runnable objects associated with a thread’s MessageQueue. Each Handler instance is associated with a single thread and that thread’s message queue. When a new Handler is created, it is bound to the thread/message queue of the thread that is creating it. The example explained in this tutorial is using below configurations JDK 1.6 Eclipse 4.2 Juno Android SKD 4.0 And tested over HTC OneX (Android 4.2) Android Activity Layout (activity_main.xml) <LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" xmlns:tools = "http://schemas.android.com/tool...