otak info official Logo   
OTAK.INFO
Personal Blog

Hariyanto Lim

정길상 / 鄭吉祥
Home   Last Posts  
 
Please login to see more topics and discussion categories.
 
goto main category list >> Software programming >> Android

Title : Android check current thread whether it is in Main UI thread of worker thread
Total Reply : 0
Total View : 2258


Harry
Harry
Total thread: 131
Total reply: 50

Post #163
Android check current thread whether it is in Main UI thread of worker thread
How to check whether current executing code is in Main UI thread or worker thread
private void throwIfNotOnMainThread() {
  if(Looper.myLooper() != Looper.getMainLooper()) {
    throw new IllegalStateException("ImageLoader must be invoked from the main thread.");
  }
}
Falling in love with the world

Write : 2015-05-20 10:54:37
Last edit : 2015-08-13 14:42:34

If you want to create a new reply then please login first.



www.OTAK.INFO
Since 19 January 2007
Page hit : 712,047

Code update 24th June 2013
Brain is a very capable to solve big problems
but requires constant reminders about how to.
peace bird