Example usage for android.os AsyncTask THREAD_POOL_EXECUTOR

List of usage examples for android.os AsyncTask THREAD_POOL_EXECUTOR

Introduction

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

Prototype

Executor THREAD_POOL_EXECUTOR

To view the source code for android.os AsyncTask THREAD_POOL_EXECUTOR.

Click Source Link

Document

An Executor that can be used to execute tasks in parallel.

Usage

From source file:com.tlongdev.bktf.presenter.fragment.RecentsPresenter.java

private void callTlongdevItemSchema() {
    TlongdevItemSchemaInteractor task = new TlongdevItemSchemaInteractor(mApplication, this);
    task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

    mTracker.send(new HitBuilders.EventBuilder().setCategory("Request").setAction("Refresh")
            .setLabel("ItemSchema").build());
}

From source file:com.opemind.cartspage.client.android.book.SearchBookContentsActivity.java

private void launchSearch() {
    String query = queryTextView.getText().toString();
    if (query != null && !query.isEmpty()) {
        AsyncTask<?, ?, ?> oldTask = networkTask;
        if (oldTask != null) {
            oldTask.cancel(true);//from  w ww.  j  ava  2s  .com
        }
        networkTask = new NetworkTask();
        networkTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, query, isbn);
        headerView.setText(R.string.msg_sbc_searching_book);
        resultListView.setAdapter(null);
        queryTextView.setEnabled(false);
        queryButton.setEnabled(false);
    }
}

From source file:de.enlightened.peris.MailFragment.java

public boolean onContextItemSelected(final MenuItem item) {
    switch (item.getItemId()) {
    case R.id.mail_delete:
        final TaskListener<ApiResult> listener = new TaskListener<ApiResult>() {
            @Override//from   w  ww .ja v  a  2s. co  m
            public void onPostExecute(final ApiResult result) {
                MailFragment.this.loadMail();
            }
        };

        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
            new DeleteMessageTask(MailFragment.this.application.getSession().getApi(),
                    MailFragment.this.selectedItem.messageId, MailFragment.this.selectedItem.folderId, listener)
                            .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
        } else {
            new DeleteMessageTask(MailFragment.this.application.getSession().getApi(),
                    MailFragment.this.selectedItem.messageId, MailFragment.this.selectedItem.folderId, listener)
                            .execute();
        }
        return true;
    default:
        return super.onContextItemSelected(item);
    }
}

From source file:com.ryan.sample.FMAsyncTaskLoader.java

public FMAsyncTaskLoader(Context context) {
    this(context, AsyncTask.THREAD_POOL_EXECUTOR);
}

From source file:org.jraf.android.util.async.TaskFragment.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void executeHoneycomb(AsyncTask<Void, Void, Boolean> asyncTask) {
    asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}

From source file:com.tagaugmentedreality.utilties.Utilities.java

@SuppressLint("NewApi")
public static ImageLoaderConfiguration configImageLoader(Context context) {

    ImageLoaderConfiguration config;//from w  ww.  java 2  s.  c  om
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {

        config = new ImageLoaderConfiguration.Builder(context).denyCacheImageMultipleSizesInMemory()
                .discCacheFileNameGenerator(new Md5FileNameGenerator())
                .taskExecutor(AsyncTask.THREAD_POOL_EXECUTOR).threadPoolSize(3)
                .tasksProcessingOrder(QueueProcessingType.LIFO).build();
    } // end if
    else {

        config = new ImageLoaderConfiguration.Builder(context).denyCacheImageMultipleSizesInMemory()
                .discCacheFileNameGenerator(new Md5FileNameGenerator()).threadPoolSize(3)
                .tasksProcessingOrder(QueueProcessingType.LIFO).build();

    } // end else
    return config;
}

From source file:com.example.android.leanback.PlaybackSeekAsyncDataProvider.java

protected void prefetch(int hintIndex, boolean forward) {
    for (Iterator<Map.Entry<Integer, Bitmap>> it = mPrefetchCache.snapshot().entrySet().iterator(); it
            .hasNext();) {/* ww  w.ja v  a2 s .  co  m*/
        Map.Entry<Integer, Bitmap> entry = it.next();
        if (forward ? entry.getKey() < hintIndex : entry.getKey() > hintIndex) {
            mPrefetchCache.remove(entry.getKey());
        }
    }
    int inc = forward ? 1 : -1;
    for (int i = hintIndex; (mRequests.size() + mPrefetchCache.size() < mPrefetchCache.maxSize())
            && (inc > 0 ? i < mSeekPositions.length : i >= 0); i += inc) {
        Integer key = i;
        if (mCache.get(key) == null && mPrefetchCache.get(key) == null) {
            LoadBitmapTask task = mRequests.get(i);
            if (task == null) {
                task = new LoadBitmapTask(key, null);
                mRequests.put(i, task);
                task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
            }
        }
    }
}

From source file:joshuatee.wx.NEXRADAttributesActivity.java

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

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    preferences = PreferenceManager.getDefaultSharedPreferences(this);
    theme_blue_current = preferences.getString("THEME_BLUE", "");
    if (theme_blue_current.contains("white")) {
        highlight_color = Color.BLUE;
        background_color = Color.BLACK;
        highlight_color_str = "blue";
        background_color_str = "black";

    }//from   www  .  java  2 s  . c  o  m
    setTheme(Utility.Theme(theme_blue_current));
    setContentView(R.layout.activity_nexradattributes);

    Resources res = getResources();

    comma = Pattern.compile(",");

    padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
            (float) res.getDimension(R.dimen.padding), getResources().getDisplayMetrics());
    padding_vertical = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
            (float) res.getDimension(R.dimen.padding_vertical), getResources().getDisplayMetrics());
    text_size = res.getDimension(R.dimen.listitem_text);

    alert_cod_radar_current = preferences.getString("ALERT_COD_RADAR", "");

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerList = (ListView) findViewById(R.id.left_drawer);
    mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, state_array));
    mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
    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);

    new GetContent().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

}

From source file:com.example.gemswin.screancasttest.MainActivity_Reciever.java

@Override
public void onConnectionLost() {
    if (!isDestroyed()) {
        mTask = new ReceiverAsyncTask(getApplicationContext(), this);
        mTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    }//from ww  w. ja  v  a2s  .co  m

}

From source file:com.rubixconsulting.walletcracker.WalletCrackerMain.java

private void forceRebuild() {
    Log.i(TAG, "force rebuild");
    new BGLoader().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, this, true);
}