multithreading - Android - Looper.prepare() in a Thread vs Activity.runOnUIThread() -
my question quite simple i'm not able find satisfying answer. question is: thread run on ui thread if call looper.prepare()
@ start of runnable
?
i know looper
messagequeue
, exchanging data between threads make code run on ui thread?
below code explain:
@override public void onreceive(final context context, intent intent) { if(intent.getaction().equals(connectivitymanager.connectivity_action)) { runnable runnable = new runnable() { @override public void run() { looper.prepare(); // ... code ... // looper.loop(); } }; thread thread = new thread(runnable); thread.start(); } }
no, not make thread run on ui thread. more info see: communicating ui thread
Comments
Post a Comment