List of usage examples for android.os AsyncTask THREAD_POOL_EXECUTOR
Executor THREAD_POOL_EXECUTOR
To view the source code for android.os AsyncTask THREAD_POOL_EXECUTOR.
Click Source Link
From source file:org.strongswan.android.ui.activity.MainActivity.java
@SuppressWarnings("ConstantConditions") @Override//from w w w . jav a 2 s . co m public void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); setContentView(R.layout.main); //?ActionBar ActionBar bar = getSupportActionBar(); bar.setDisplayShowHomeEnabled(true); bar.setDisplayShowTitleEnabled(false); bar.setIcon(R.drawable.ic_launcher); //?? this.bindService(new Intent(this, VpnStateService.class), mServiceConnection, Service.BIND_AUTO_CREATE); /* load CA certificates in a background task */ //??? new LoadCertificatesTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }
From source file:com.dm.material.dashboard.candybar.helpers.RequestHelper.java
public static void prepareIconRequest(@NonNull Context context) { new AsyncTask<Void, Void, Boolean>() { @Override//from ww w . j a v a 2 s.c o m protected Boolean doInBackground(Void... voids) { while (!isCancelled()) { try { Thread.sleep(1); if (context.getResources().getBoolean(R.bool.enable_icon_request) || context.getResources().getBoolean(R.bool.enable_premium_request)) { CandyBarMainActivity.sMissedApps = RequestHelper.loadMissingApps(context); } return true; } catch (Exception e) { LogUtil.e(Log.getStackTraceString(e)); return false; } } return false; } @Override protected void onPostExecute(Boolean aBoolean) { super.onPostExecute(aBoolean); if (aBoolean) { if (context == null) return; FragmentManager fm = ((AppCompatActivity) context).getSupportFragmentManager(); if (fm == null) return; Fragment fragment = fm.findFragmentByTag("home"); if (fragment == null) return; HomeListener listener = (HomeListener) fragment; listener.onHomeDataUpdated(null); } } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }
From source file:io.demiseq.jetreader.service.DownloadService.java
private void getChapterToDownload() { synchronized (list) { while (numberOfDownload < maxDownload && list.size() > 0) { if (stop) break; Chapter c = list.get(0);/*from w ww. jav a 2 s .com*/ RetrieveAllPages task = new RetrieveAllPages(c.getMangaName(), c.getName()); task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, c.getUrl()); numberOfDownload++; list.remove(0); builder.setContentText(getResources().getString(R.string.background_progress)); builder.setStyle(new NotificationCompat.BigTextStyle() .bigText(getResources().getString(R.string.downloading) + " " + numberOfDownload + "\n" + getResources().getString(R.string.queuing) + " " + list.size())); notificationManager.notify(1337, builder.build()); } } }
From source file:de.qspool.clementineremote.backend.ClementineSongDownloader.java
public void startDownload(ClementineMessage message) { mItem = message.getMessage().getRequestDownloadSongs().getDownloadItem(); this.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, message); }
From source file:com.bukanir.android.activities.SearchActivity.java
private void handleSearchIntent(Intent intent) { Log.d(TAG, "handleSearchIntent"); if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); if (Utils.isNetworkAvailable(this)) { searchTask = new SearchTask(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { searchTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, query); } else { searchTask.execute(query); }// ww w . j a v a2 s . c o m } else { Toast.makeText(this, getString(R.string.network_not_available), Toast.LENGTH_LONG).show(); } } }
From source file:com.tlongdev.bktf.presenter.fragment.RecentsPresenter.java
private void callTlongdevPrices(boolean updateDatabase, boolean manualSync) { TlongdevPriceListInteractor interactor = new TlongdevPriceListInteractor(mApplication, updateDatabase, manualSync, this); interactor.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); mLoading = true;/*from w ww .ja v a 2 s . com*/ mTracker.send(new HitBuilders.EventBuilder().setCategory("Request").setAction("Refresh").setLabel("Prices") .build()); }
From source file:com.microsoft.office365.http.FroyoHttpConnection.java
@SuppressLint("NewApi") private void executeTask(AsyncTask<Void, Void, Void> task) { // If it's running with Honeycomb or greater, it must execute each // request in a different thread if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else {/* w ww . jav a2s.c om*/ task.execute(); } }
From source file:joshuatee.wx.SPCMesoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); preferences = PreferenceManager.getDefaultSharedPreferences(this); editor = preferences.edit();// www . j a v a2s .c o m String theme_blue_current = preferences.getString("THEME_BLUE", ""); setTheme(Utility.Theme(theme_blue_current)); setContentView(R.layout.activity_spcmeso); InitSectorMap(); layers = new Drawable[2]; cd = new ColorDrawable(Color.WHITE); param = preferences.getString("SPCMESO_LAST_USED", param); sector = preferences.getString("SPCMESO_SECTOR_LAST_USED", sector); setTitle(param + " - " + sector_map.get(sector)); img = (TouchImageView2) findViewById(R.id.iv); dm = new DisplayMetrics(); this.getWindowManager().getDefaultDisplay().getMetrics(dm); createData(); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ExpandableListView) findViewById(R.id.left_drawer); MyExpandableListAdapter adapter = new MyExpandableListAdapter(this, groups); mDrawerList.setAdapter(adapter); mDrawerList.setOnChildClickListener(new DrawerItemClickListener2()); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.drawer, R.string.drawer_open, R.string.drawer_close) { public void onDrawerClosed(View view) { super.onDrawerClosed(view); } public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); } }; mDrawerLayout.setDrawerListener(mDrawerToggle); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); img_url = "http://www.spc.noaa.gov/exper/mesoanalysis/new/meso_mob.php?sector=" + sector + "&parm=" + param; new GetContent().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }
From source file:com.toppatch.mv.ui.activities.LoginActivity2.java
@SuppressWarnings("unchecked") private void startLoginCheck() { Log.d(TAG, "startLoginCheck"); CheckLoginAsyncTask check = new CheckLoginAsyncTask(); ArrayList<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair(Constants.LOGIN_ACTIVITY_EMAIL, email.getText().toString())); params.add(new BasicNameValuePair(Constants.LOGIN_ACTIVITY_PASSCODE, passcode.getText().toString())); params.add(new BasicNameValuePair(Constants.LOGIN_ACTIVITY_GCM, gcmId)); TelephonyManager mngr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); params.add(new BasicNameValuePair(Constants.IMEI, mngr.getDeviceId())); Log.d("see", "sss:" + gcmId); check.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); }
From source file:com.kytse.aria2remote.DownloadListFragment.java
@Override public void onRefresh() { if (mGetDownloadListAsyncTask == null || mGetDownloadListAsyncTask.getStatus() != AsyncTask.Status.RUNNING) { mGetDownloadListAsyncTask = new GetDownloadListAsyncTask(); mGetDownloadListAsyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }/*www . jav a 2s . com*/ }