List of usage examples for android.os HandlerThread HandlerThread
public HandlerThread(String name)
From source file:com.nolanlawson.cordova.sqlite.SQLitePlugin.java
private Handler createBackgroundHandler() { HandlerThread thread = new HandlerThread("SQLitePlugin BG Thread"); thread.start();/* w w w .j a v a 2s . c o m*/ return new Handler(thread.getLooper()); }
From source file:com.tenforwardconsulting.cordova.bgloc.AbstractLocationProvider.java
public void onCreate() { toneGenerator = new ToneGenerator(AudioManager.STREAM_NOTIFICATION, 100); handlerThread = new HandlerThread("LocationProviderThread"); handlerThread.start();//ww w .ja v a2 s. co m }
From source file:com.cssweb.android.quote.DaPan.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); HandlerThread mHandlerThread = new HandlerThread("CSSWEB_THREAD"); mHandlerThread.start();/* w w w. ja v a2 s. c o m*/ mHandler = new MessageHandler(mHandlerThread.getLooper()); this.activityKind = Global.QUOTE_DAPAN; setContentView(R.layout.zr_table); String[] toolbarname = new String[] { Global.TOOLBAR_MENU, Global.TOOLBAR_SHANGYE, Global.TOOLBAR_XIAYIYE, Global.TOOLBAR_REFRESH }; initTitle(R.drawable.njzq_title_left_back, 0, ""); initToolBar(toolbarname, Global.BAR_TAG); cols = getResources().getStringArray(R.array.index_cols); //???? pageNum = CssSystem.getTablePageSize(mContext); rowHeight = CssSystem.getTableRowHeight(mContext); begin = 1; end = pageNum; allStockNums = StockInfo.getStockInfoSize(20); setToolBar(1, false, R.color.zr_newlightgray); init(2); }
From source file:org.projectbuendia.client.diagnostics.UpdateServerHealthCheck.java
@Override protected void startImpl() { synchronized (mLock) { if (mHandlerThread == null) { mHandlerThread = new HandlerThread("Buendia Update Server Health Check"); mHandlerThread.start();//from w w w.ja v a 2s. co m mHandler = new Handler(mHandlerThread.getLooper()); mHandler.post(mHealthCheckRunnable); } } }
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 ww w .ja v a 2 s . c o m*/ backgroundHandler = new Handler(handlerThread.getLooper(), sCallback); uiHandler = new Handler(context.getMainLooper(), sCallback); }
From source file:com.cssweb.android.quote.QuoteDetail.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); HandlerThread mHandlerThread = new HandlerThread("CSSWEB_THREAD"); mHandlerThread.start();/*w w w . j a v a 2 s . c o m*/ mHandler = new MessageHandler(mHandlerThread.getLooper()); setContentView(R.layout.zr_quote_price); initTitle(R.drawable.njzq_title_left_back, 0, ""); Bundle bundle = getIntent().getExtras(); this.exchange = bundle.getString("exchange"); this.stockcode = bundle.getString("stockcode"); this.stocktype = bundle.getString("stocktype"); this.type = NameRule.getSecurityType(exchange, stockcode); if (stocktype == null || stocktype.equals("")) stocktype = NameRule.getStockType(type); table_1 = (TableLayout) findViewById(R.id.zr_rt_tableview_1); setTitleText(getResources().getString(R.string.cjmx_title)); customScrollView = (CustomScrollView) findViewById(R.id.zr_htable_vscroll); customScrollView.setOnTouchListener(this); customScrollView.setGestureDetector(gestureDetector); }
From source file:org.tlc.whereat.modules.schedule.Scheduler.java
/** * Periodically deletes all records older than a certain time-to-live threshold from DB * * @param interval Interval for running `forget` (in millis) * @param ttl Amount of time (in millis) that a loc record should live before being forgotten * @param now Current time in millis since 1970 (paramaterized as optional for mocking in tests) *//*from w w w . java 2 s .c om*/ public void forget(long interval, long ttl, long... now) { HandlerThread thread = new HandlerThread("HandlerThread"); thread.start(); mForgetHandler = new Handler(Looper.getMainLooper()); mForgetRunnable = new Runnable() { @Override public void run() { long rightNow = now.length > 0 ? now[0] : new Date().getTime(); broadcastForget(mLbm, mCtx, rightNow - ttl); mForgetHandler.postDelayed(this, interval); } }; mForgetHandler.postDelayed(mForgetRunnable, interval); }
From source file:com.cssweb.android.quote.FenLei.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); HandlerThread mHandlerThread = new HandlerThread("CSSWEB_THREAD"); mHandlerThread.start();//from w ww . j a v a 2 s. co m mHandler = new MessageHandler(mHandlerThread.getLooper()); Bundle bundle = getIntent().getExtras(); this.requestType = bundle.getInt("requestType"); this.activityKind = Global.QUOTE_FENLEI; requestParams = new RequestParams(); requestParams.setMarket("SHSZA"); requestParams.setPaixu("zqdm"); setContentView(R.layout.zr_table); String[] toolbarname = new String[] { Global.TOOLBAR_MENU, Global.TOOLBAR_PINGZHONG, Global.TOOLBAR_PAIXU, Global.TOOLBAR_SHANGYE, Global.TOOLBAR_XIAYIYE, Global.TOOLBAR_REFRESH }; initTitle(R.drawable.njzq_title_left_back, 0, ""); initToolBar(toolbarname, Global.BAR_TAG); cols = getResources().getStringArray(R.array.stock_cols); menu = getResources().getStringArray(R.array.stock_type_menu); paiming = getResources().getStringArray(R.array.zqpm_menu); desc = getResources().getStringArray(R.array.stock_desc); //A title1 = menu[6]; //title2 = paiming[0]; //???? allStockNums = StockInfo.getStockInfoSize(stocktype); pageNum = CssSystem.getTablePageSize(FenLei.this); rowHeight = CssSystem.getTableRowHeight(FenLei.this); openOption(); openPopup(); requestParams.setBegin("1"); requestParams.setEnd(String.valueOf(pageNum)); setToolBar(3, false, R.color.zr_newlightgray); init(2); }
From source file:org.teleportr.ConnectorService.java
@Override public void onCreate() { HandlerThread thread = new HandlerThread(WORKER); thread.start();/*from w w w. j a v a 2 s.c o m*/ worker = new Handler(thread.getLooper()); reporter = new Handler(); try { fahrgemeinschaft = (Connector) Class.forName(FAHRGEMEINSCHAFT).newInstance(); fahrgemeinschaft.setContext(this); gplaces = (Connector) Class.forName(GPLACES).newInstance(); gplaces.setContext(this); } catch (Exception e) { e.printStackTrace(); } search = new Search(getContext()); resolve = new Resolve(getContext()); publish = new Publish(getContext()); myrides = new Myrides(getContext()); retries = new HashMap<Long, Integer>(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.registerOnSharedPreferenceChangeListener(this); onSharedPreferenceChanged(prefs, VERBOSE); cleanUp(prefs); super.onCreate(); }
From source file:mobi.cangol.mobile.base.BaseFragmentActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); Log.setLogTag(this); startTime = System.currentTimeMillis(); handlerThread = new HandlerThread(TAG); handlerThread.start();/*from ww w . jav a2s. co m*/ handler = new InternalHandler(this, handlerThread.getLooper()); app = (CoreApplication) this.getApplication(); app.addActivityToManager(this); }