Класс используется для запуска цикла обработки сообщений для потока. Потоки по умолчанию не имеют связанного с ними цикла сообщений; чтобы создать один, вызовите prepare() в потоке, который должен запустить цикл, а затем loop(), чтобы обработать сообщения до тех пор, пока цикл не будет остановлен.
Большая часть взаимодействия с контуром сообщения осуществляется через класс Handler.
Ниже приведен способ выполнения резьбы
@Override
public void run() {
try {
// preparing a looper on current thread
// the current thread is being detected implicitly
Looper.prepare();
Log.i(TAG, "DownloadThread entering the loop");
// now, the handler will automatically bind to the
// Looper that is attached to the current thread
// You don't need to specify the Looper explicitly
handler = new Handler();
// After the following line the thread will start
// running the message loop and will not normally
// exit the loop unless a problem happens or you
// quit() the looper (see below)
Looper.loop();
Log.i(TAG, "DownloadThread exiting gracefully");
} catch (Throwable t) {
Log.e(TAG, "DownloadThread halted due to an error", t);
}
}
http://stackoverflow.com/questions/7597742/android-what-is-the-purpose-of-looper-and-how-to-use-it –
Возможный дубликат ... HTTP : //stackoverflow.com/questions/5193913/handlers-messagequeue-looper-do-they-all-run-on-the-ui-thread –