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:eu.musesproject.client.connectionmanager.ConnectionManager.java
/** * Connect to the server with specified parameter * @param url/*from w ww. jav a 2 s .c om*/ * @param pollInterval * @param sleepPollInterval * @param callbacks * @param context * @return void */ @Override public void connect(String url, int pollInterval, int sleepPollInterval, IConnectionCallbacks callbacks, Context context) { URL = url; AlarmReceiver.POLL_INTERVAL = pollInterval; AlarmReceiver.SLEEP_POLL_INTERVAL = sleepPollInterval; AlarmReceiver.DEFAULT_POLL_INTERVAL = pollInterval; AlarmReceiver.DEFAULT_SLEEP_POLL_INTERVAL = sleepPollInterval; AlarmReceiver.LAST_SENT_POLL_INTERVAL = pollInterval; callBacks = callbacks; this.context = context; NetworkChecker networkChecker = new NetworkChecker(context); PhoneModeReceiver phoneModeReceiver = new PhoneModeReceiver(context); phoneModeReceiver.register(); Log.d(TAG, "Connecting .."); if (networkChecker.isInternetConnected()) { HttpClientAsyncThread httpClientAsyncThread = new HttpClientAsyncThread(); httpClientAsyncThread.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, CONNECT, URL, Integer.toString(AlarmReceiver.DEFAULT_POLL_INTERVAL), ""); } else callBacks.statusCb(Statuses.CONNECTION_FAILED, DetailedStatuses.NO_INTERNET_CONNECTION); alarmReceiver = new AlarmReceiver(); alarmReceiver.setAlarm(context); }
From source file:com.tlongdev.bktf.presenter.fragment.UserPresenter.java
@Override public void onUserInfoFinished(User user) { Tf2UserBackpackInteractor interactor = new Tf2UserBackpackInteractor(mApplication, user, false, this); interactor.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); mTracker.send(new HitBuilders.EventBuilder().setCategory("Request").setAction("UserBackpack").build()); }
From source file:paarmann.physikprofil.HomeworkUpdater.java
/** * Create a new {@code AsyncTask} for loading the cached homework and returning it. *//*from w w w. j a va2 s.c om*/ private void loadHomeworkFromFile() { Log.i(TAG, "Loading homework from file"); FileTask task = new FileTask(); task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, false); }
From source file:de.enlightened.peris.MailFragment.java
private void loadMail() { this.mailDownloader = new DownloadMailTask(); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { this.mailDownloader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else {/*from w w w .j a v a2s . c o m*/ this.mailDownloader.execute(); } }
From source file:com.microsoft.activitytracker.Core.NetworkCalls.java
public static Object getAuthority(String endpoint) { try {/*from ww w . j a v a 2s. co m*/ AsyncTask authTask = new getAuthorityTask(endpoint).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); return authTask.get(); } catch (Exception ex) { ex.printStackTrace(); } return null; }
From source file:com.dm.material.dashboard.candybar.fragments.dialog.LanguagesFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mAsyncTask = new LanguagesLoader().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }
From source file:com.adarshahd.indianrailinfo.donate.PNRTracker.java
@Override public void onReceive(Context context, Intent intent) { mContext = context;/* ww w . ja va 2s .c o m*/ mPref = PreferenceManager.getDefaultSharedPreferences(mContext); ArrayList<String> list = (ArrayList<String>) PNRDatabase.getPNRDatabase(mContext).getPNRTrackList(); for (String pnrNumber : list) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { try { new PNRStatus().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, pnrNumber); } catch (Exception e) { e.printStackTrace(); } } else { try { new PNRStatus().execute(pnrNumber); } catch (Exception e) { e.printStackTrace(); } } } }
From source file:fr.haploid.webservices.WebServicesPlugin.java
@Override public void onMessage(CobaltPluginWebContainer webContainer, JSONObject message) { try {//from w ww.j a v a2 s.c om String action = message.getString(Cobalt.kJSAction); if (action.equals(JSActionCall)) { CobaltFragment fragment = webContainer.getFragment(); long time = System.currentTimeMillis(); try { JSONObject data = new JSONObject(); data.put(kJSCallId, time); fragment.sendCallback(message.getString(Cobalt.kJSCallback), data); message.put(kJSCallId, time); WebServicesTask wsTask = new WebServicesTask(fragment, message); if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) wsTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); else wsTask.execute(); } catch (JSONException exception) { if (Cobalt.DEBUG) { Log.e(TAG, "onMessage: missing callback key in message " + message.toString() + "."); exception.printStackTrace(); } } } else if (Cobalt.DEBUG) Log.e(TAG, "onMessage: invalid action " + action + "in message " + message.toString() + "."); } catch (JSONException exception) { if (Cobalt.DEBUG) { Log.e(TAG, "onMessage: missing action key in message " + message.toString() + "."); exception.printStackTrace(); } } }
From source file:io.imoji.sdk.editor.fragment.OutlineTaskFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRetainInstance(true);//w ww .j ava 2s.c om mToken = getArguments().getString(CREATE_TOKEN_BUNDLE_ARG_KEY); Bitmap b = EditorBitmapCache.getInstance().get(mToken); if (b == null) { Log.w(LOG_TAG, "token was not set to create outline"); notifyFailure(getActivity()); return; } OutlineAsyncTask task = new OutlineAsyncTask(b, IMOJI_WIDTH_BOUND, IMOJI_HEIGHT_BOUND, this); if (Build.VERSION.SDK_INT >= 11) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { task.execute(); } }
From source file:com.librelio.activity.StartupActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.startup);//from ww w .j av a 2s . c o m startupImage = (ImageView) findViewById(R.id.sturtup_image); advertisingImage = (ImageView) findViewById(R.id.advertising_image); new InitPredefinedMagazinesTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // new LoadAdvertisingImageTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); loadAndShowAdvertising(); }