org.solovyev.android
Class Threads

java.lang.Object
  extended by org.solovyev.android.Threads

public final class Threads
extends Object

User: serso Date: 2/2/13 Time: 5:55 PM


Method Summary
static boolean isUiThread()
           
static android.os.Handler newUiHandler()
           
static void tryRunOnUiThread(android.app.Activity activity, Runnable runnable)
          Method tries to run runnable on UI thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

tryRunOnUiThread

public static void tryRunOnUiThread(@Nullable
                                    android.app.Activity activity,
                                    @Nonnull
                                    Runnable runnable)
Method tries to run runnable on UI thread. Run can be failed if: 1. Specified activity is null 2. Specified activity is finishing

Parameters:
activity - activity bound to runnable
runnable - runnable to bve executed

isUiThread

public static boolean isUiThread()
Returns:
true if current thread is UI thread (= main application thread)

newUiHandler

@Nonnull
public static android.os.Handler newUiHandler()
Returns:
new instance of Handler which runs on UI thread


Copyright © 2013. All Rights Reserved.