List of usage examples for android.os HandlerThread getLooper
public Looper getLooper()
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();/*from www. jav a2 s .c om*/ 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:com.uphyca.idobata.android.service.IdobataService.java
private void ensureHandler() { HandlerThread t = new HandlerThread("IdobataService", Process.THREAD_PRIORITY_BACKGROUND); t.start();/* www .ja v a2 s.c om*/ mServiceLooper = t.getLooper(); mServiceHandler = new ServiceHandler(mServiceLooper); }
From source file:com.irccloud.android.IRCCloudApplicationBase.java
private Handler getFontsHandler() { if (mFontsHandler == null) { HandlerThread handlerThread = new HandlerThread("fonts"); handlerThread.start();/*from www. j av a 2 s .com*/ mFontsHandler = new Handler(handlerThread.getLooper()); } return mFontsHandler; }
From source file:com.tenkiv.tekdaqc.android.services.CommunicationService.java
@Override public void onCreate() { super.onCreate(); Log.d(TAG, "CommunicationService onCreate()"); // Setup the background thread and its controls HandlerThread thread = new HandlerThread("TekDAQC Communication Service", Process.THREAD_PRIORITY_BACKGROUND); thread.start();/*from w ww . j a va 2 s. com*/ mServiceLooper = thread.getLooper(); mServiceHandler = new ServiceHandler(mServiceLooper, this); mLocalBroadcastMgr = LocalBroadcastManager.getInstance(getApplicationContext()); // Initialize the session map mCommSessions = new ConcurrentHashMap<String, ASCIICommunicationSession>(); }
From source file:com.csipsimple.utils.ContactsAsyncHelper.java
/** * Private constructor for static class// ww w. ja v a2 s . c o m */ private ContactsAsyncHelper() { HandlerThread thread = new HandlerThread("ContactsAsyncWorker"); thread.start(); sThreadHandler = new WorkerHandler(thread.getLooper()); contactsWrapper = ContactsWrapper.getInstance(); }
From source file:edu.mit.media.funf.pipeline.BasicPipeline.java
@Override public void onCreate(FunfManager manager) { if (archive == null) { archive = new DefaultArchive(manager, name); }/* w w w. ja va2 s .c o m*/ if (uploader == null) { uploader = new UploadService(manager); uploader.start(); } this.manager = manager; reloadDbHelper(manager); HandlerThread thread = new HandlerThread(getClass().getName()); thread.start(); this.looper = thread.getLooper(); this.handler = new Handler(looper, callback); enabled = true; for (JsonElement dataRequest : data) { manager.requestData(this, dataRequest); } for (Map.Entry<String, Schedule> schedule : schedules.entrySet()) { manager.registerPipelineAction(this, schedule.getKey(), schedule.getValue()); } }
From source file:com.example.joeroger.homework2.activity.WeatherActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Turn on strict mode in debug builds if (BuildConfig.DEBUG) { StrictMode.enableDefaults();// w w w. j ava2 s. c o m } setContentView(R.layout.activity_weather); setSupportActionBar((Toolbar) findViewById(R.id.toolBar)); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowTitleEnabled(false); Spinner spinner = (Spinner) findViewById(R.id.city_spinner); citySpinnerCursorAdapter = new CitySpinnerCursorAdapter(actionBar.getThemedContext(), null); spinner.setAdapter(citySpinnerCursorAdapter); spinner.setOnItemSelectedListener(this); ViewCompat.setElevation(spinner, 0); } HandlerThread handlerThread = new HandlerThread("WeatherActivityThread"); handlerThread.start(); handler = new Handler(handlerThread.getLooper(), this); resolvingError = savedInstanceState != null && savedInstanceState.getBoolean(STATE_RESOLVING_ERROR); CityConditionsLoaderCallbacks.initLoader(getSupportLoaderManager(), this, this, CitySpinnerCursorAdapter.PROJECTION, CityConditionsContract.WHERE_CURRENT_OR_FAVORITE, CityConditionsContract.WHERE_CURRENT_OR_FAVORITE_ARGS); }
From source file:com.peptrack.gps.locationupdatesforegroundservice.LocationUpdatesService.java
@Override public void onCreate() { mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this); mLocationCallback = new LocationCallback() { @Override//from ww w .j a v a 2 s .co m public void onLocationResult(LocationResult locationResult) { super.onLocationResult(locationResult); onNewLocation(locationResult.getLastLocation()); } }; createLocationRequest(); getLastLocation(); HandlerThread handlerThread = new HandlerThread(TAG); handlerThread.start(); mServiceHandler = new Handler(handlerThread.getLooper()); mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Android O requires a Notification Channel. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { CharSequence name = getString(R.string.app_name); // Create the channel for the notification NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID, name, NotificationManager.IMPORTANCE_DEFAULT); // Set the Notification Channel for the Notification Manager. mNotificationManager.createNotificationChannel(mChannel); } }
From source file:cn.studyjams.s2.sj0132.bowenyan.mygirlfriend.nononsenseapps.notepad.data.service.OrgSyncService.java
@Override public void onCreate() { // Start up the thread running the service. Note that we create a // separate thread because the service normally runs in the process's // main thread, which we don't want to block. We also make it // background priority so CPU-intensive work will not disrupt our UI. HandlerThread thread = new HandlerThread("ServiceStartArguments", Process.THREAD_PRIORITY_BACKGROUND); thread.start();//from ww w . j ava 2s.com // Get the HandlerThread's Looper and use it for our Handler serviceLooper = thread.getLooper(); serviceHandler = new SyncHandler(serviceLooper); }
From source file:org.fdroid.fdroid.net.DownloaderService.java
@Override public void onCreate() { super.onCreate(); Utils.debugLog(TAG, "Creating downloader service."); HandlerThread thread = new HandlerThread(TAG, Process.THREAD_PRIORITY_BACKGROUND); thread.start();//from ww w . j a v a2 s. c o m serviceLooper = thread.getLooper(); serviceHandler = new ServiceHandler(serviceLooper); localBroadcastManager = LocalBroadcastManager.getInstance(this); }