最終更新:2016-09-27 (火) 17:35:27 (2739d)
android.os.Looper
Top / android.os.Looper
Class used to run a message loop for a thread.
https://developer.android.com/reference/android/os/Looper.html
動作
- 自身が持っているメッセージキューからメッセージを取り出して処理を実行
メモ
- Threads by default do not have a message loop associated with them; to create one, call Looper.prepare() in the thread that is to run the loop, and then Looper.loop() to have it process messages until the loop is stopped.
メモ
- The main looper for your application is created by the Android environment
- メインスレッドはLooperが基本的に生成されているが、新たに生成したスレッドは基本的にLooperを持っていない
メソッド
Looper.getMainLooper() Returns the application's main looper, which lives in the main thread of the application. Looper.prepareMainLooper() Initialize the current thread as a looper, marking it as an application's main looper. Looper.myLooper? Return the Looper object associated with the current thread.
Looper.prepare();
Looper.loop
- メッセージキューからメッセージを取り出してdispatch