Example usage for android.os Handler Handler

List of usage examples for android.os Handler Handler

Introduction

In this page you can find the example usage for android.os Handler Handler.

Prototype

public Handler(Callback callback, boolean async) 

Source Link

Document

Use the Looper for the current thread with the specified callback interface and set whether the handler should be asynchronous.

Usage

From source file:com.musenkishi.wally.util.PaletteLoader.java

private static void setupHandlers(Context context) {
    HandlerThread handlerThread = new HandlerThread("palette-loader-background");
    handlerThread.start();/*from   www  .  j  a  va  2s  . c  o m*/
    backgroundHandler = new Handler(handlerThread.getLooper(), sCallback);
    uiHandler = new Handler(context.getMainLooper(), sCallback);
}

From source file:ti.modules.titanium.geolocation.TiLocation.java

public TiLocation() {
    locationManager = (LocationManager) TiApplication.getInstance().getSystemService(Context.LOCATION_SERVICE);
    knownProviders = locationManager.getAllProviders();
    mobileId = TiPlatformHelper.getMobileId();
    appGuid = TiApplication.getInstance().getAppInfo().getGUID();
    sessionId = TiPlatformHelper.getSessionId();
    countryCode = Locale.getDefault().getCountry();
    runtimeHandler = new Handler(TiMessenger.getRuntimeMessenger().getLooper(), this);
}

From source file:cn.sharesdk.analysis.server.ServiceHelper.java

private ServiceHelper(RemoteService service) {
    super("ShareSDK Statistics Service");
    start();//from  www  .  ja  v  a 2s . c  o  m
    handler = new Handler(this.getLooper(), this);
    this.context = service.getApplicationContext();
    preference = PreferencesHelper.getInstance(context);
    deviceHelper = DeviceHelper.getInstance(context);
    sendIsAppExitMsg();
}

From source file:com.musenkishi.atelier.Atelier.java

private static void setupHandlers(Context context) {
    HandlerThread handlerThread = new HandlerThread("palette-loader-background");
    handlerThread.start();//from  w w w .  ja v  a 2 s.  com
    backgroundHandler = new Handler(handlerThread.getLooper(), callback);
    uiHandler = new Handler(context.getMainLooper(), callback);
}

From source file:org.peterbaldwin.vlcremote.sweep.PortSweeper.java

public PortSweeper(int port, String file, int threadCount, Callback callback, Looper looper) {
    mPort = port;//from   www .  j  a v a  2  s.  c o m
    mPath = file;
    mWorkerCount = threadCount;
    mCallback = callback;

    mAddressQueue = new ConcurrentLinkedQueue<byte[]>();

    mWorkerManager = new MyWorkerManager();

    mWorkerCallback = new MyWorkerCallback();

    mScanThread = new HandlerThread("Scanner", Process.THREAD_PRIORITY_BACKGROUND);
    mScanThread.start();

    Handler.Callback callbackHandlerCallback = new MyCallbackHandlerCallback();
    mCallbackHandler = new Handler(looper, callbackHandlerCallback);

    Handler.Callback scanHandlerCallback = new MyScanHandlerCallback();
    mScanHandler = new Handler(mScanThread.getLooper(), scanHandlerCallback);
}