Example usage for android.os HandlerThread HandlerThread

List of usage examples for android.os HandlerThread HandlerThread

Introduction

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

Prototype

public HandlerThread(String name) 

Source Link

Usage

From source file:org.peercast.pecaport.PecaPortService.java

@Override
public void onCreate() {
    super.onCreate();
    logger.info(getString(R.string.t_log_starting) + "PecaPortService");

    HandlerThread thread = new HandlerThread(TAG);
    thread.start();//from  ww w .j  av a  2s  .c  om

    mServiceHandler = new ServiceHandler(thread.getLooper());
    mUiThreadHandler = new Handler(Looper.getMainLooper());
    mRouterDiscoverer = new RouterDiscoverer(getApplicationContext(), this);

    NetworkDeviceManager nicManager = NetworkDeviceManager.from(this);
    mActiveNicInfo = nicManager.getActiveInterface();
}

From source file:com.sibext.android.activity.RedmineReportActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    tryGetArgumentsFromManifest();//  w w w  .  ja  v  a  2s. c om
    if (invalidArguments()) {
        tryGetArgumentsFromResources();
    }
    if (invalidArguments()) {
        throw new RuntimeException("Please setup readmine in your manifest or in your resources!");
    }
    thread = new HandlerThread(TAG);
    thread.start();
    handler = new Handler(thread.getLooper());
    manager = new RedmineManager(redmineHost, redmineKey);
}

From source file:com.cssweb.android.quote.KLine2Activity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    HandlerThread mHandlerThread = new HandlerThread("CSSWEB_THREAD");
    mHandlerThread.start();//  ww  w  .  j a v a 2 s  .  co  m
    mHandler = new MessageHandler(mHandlerThread.getLooper());

    this.activityKind = Global.QUOTE_KLINE;

    Bundle bundle = getIntent().getExtras();
    this.exchange = bundle.getString("exchange");
    this.stockcode = bundle.getString("stockcode");
    this.stockname = bundle.getString("stockname");
    CssSystem.exchange = bundle.getString("exchange");
    CssSystem.stockcode = bundle.getString("stockcode");
    CssSystem.stockname = bundle.getString("stockname");

    cssStock = new CssStock();
    cssStock.setMarket(this.exchange);
    cssStock.setStkcode(this.stockcode);
    cssStock.setStkname(this.stockname);

    setContentView(R.layout.zr_klineview2);

    //      toolbarname = new String[]{ 
    //            Global.TOOLBAR_MENU, Global.TOOLBAR_ZHIBIAO, 
    //            Global.TOOLBAR_ZHOUQI, Global.TOOLBAR_F10, 
    //            Global.TOOLBAR_ZOOMOUT, Global.TOOLBAR_ZOOMIN };
    toolbarname = new String[] { Global.TOOLBAR_MENU, Global.TOOLBAR_FENSHI, Global.TOOLBAR_ZHOUQI,
            Global.TOOLBAR_ZHIBIAO, Global.TOOLBAR_F10, Global.TOOLBAR_REFRESH };

    if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
        setToolbarByScreen(2);
    } else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        setToolbarByScreen(1);
    }

    initTitle(R.drawable.njzq_title_left_back, 0, "K");

    setTitleText(stockname + " " + peroidN);

    initKlineView();

    getZhibiao();
    getZhouqi();
}

From source file:ch.luethi.skylinestracker.PositionService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    skyLinesTrackingWriter = null;//from  w ww  .  j a v  a2  s. c  om
    initConnectionStatus();
    ipAddress = prefs.getIpAddress();
    senderThread = new HandlerThread("SenderThread");
    senderThread.start();
    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, prefs.getTrackingInterval() * 1000, 0,
            this, senderThread.getLooper());
    return START_STICKY;
}

From source file:net.sf.aria2.Aria2Service.java

@Override
public void onCreate() {
    super.onCreate();

    link = new Binder();

    reusableThread = new HandlerThread("Aria2 handler thread");
    reusableThread.start();//w w  w .  j a  v  a2 s .  com

    bgThreadHandler = new Handler(reusableThread.getLooper());
}

From source file:com.nhn.android.archetype.base.AABaseApplication.java

protected void initM2base() {

    // m2base code
    workExecutor = Executors.newCachedThreadPool();
    handler = new Handler(Looper.getMainLooper());
    backgroundHandlerThread = new HandlerThread("BandBackgroundHandlerThread");
    backgroundHandlerThread.start();//w  w w . ja v  a2  s. co m
    backgroundHandler = new Handler(backgroundHandlerThread.getLooper());

    JsonWorker.init();

    logger.d("Application init completed.....");
}

From source file:de.persoapp.android.activity.fragment.ProgressFragment.java

public ProgressFragment() {
    setArguments(new Bundle());

    HandlerThread handlerThread = new HandlerThread("progressAnimator");
    handlerThread.start();//w w w .j  a va2s . c om
    mHandler = new MyHandler(handlerThread.getLooper());
}

From source file:fr.enseirb.odroidx.videomanager.Uploader.java

public void onCreate() {
    Log.i(getClass().getSimpleName(), "Uploader on create");
    HandlerThread thread = new HandlerThread("Uploader");
    thread.start();/*from   w w w .j a  va2  s. c om*/

    mUploadLooper = thread.getLooper();
    mUploadHandler = new ServiceHandler(mUploadLooper);
}

From source file:org.projectbuendia.client.diagnostics.BuendiaApiHealthCheck.java

@Override
protected void startImpl() {
    synchronized (mLock) {
        if (mHandlerThread == null) {
            mHandlerThread = new HandlerThread("Buendia API Health Check");
            mHandlerThread.start();//w w w . jav  a2s  .  c o  m
            mHandler = new Handler(mHandlerThread.getLooper());
        }

        if (mRunnable == null) {
            mRunnable = new BuendiaModuleHealthCheckRunnable(mHandler);
        }

        if (!mRunnable.isRunning.getAndSet(true)) {
            mHandler.post(mRunnable);
        }
    }
}

From source file:com.leanplum.internal.WebSocketClient.java

public WebSocketClient(URI uri, Listener listener, List<BasicNameValuePair> extraHeaders) {
    mURI = uri;//from w w w  .j a  va  2  s  .c  o  m
    mListener = listener;
    mExtraHeaders = extraHeaders;
    mParser = new HybiParser(this);

    mHandlerThread = new HandlerThread("websocket-thread");
    mHandlerThread.start();
    mHandler = new Handler(mHandlerThread.getLooper());
}