org.solovyev.android
Class Threads

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

public final class Threads
extends Object


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.
static void tryRunOnUiThread(Fragment fragment, Runnable runnable)
           
 
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

tryRunOnUiThread

public static void tryRunOnUiThread(@Nonnull
                                    Fragment fragment,
                                    @Nonnull
                                    Runnable runnable)

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 © 2014 se.solovyev. All Rights Reserved.