Code example for AsyncTask

Methods: executeOnExecutor

0
        mStartInternalAbuse = (Button) findViewById(R.id.start_internal_abuse);
        mStartInternalAbuse.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                if (mInternalAbuseTask == null) {
                    mInternalAbuseTask = new AbuseTask(getCacheDir(), true);
                    mInternalAbuseTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
                    updateButtonState(); 
                } 
            } 
        }); 
 
        mStartSlowInternalAbuse = (Button) findViewById(R.id.start_slow_internal_abuse);
        mStartSlowInternalAbuse.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                if (mInternalAbuseTask == null) {
                    mInternalAbuseTask = new AbuseTask(getCacheDir(), false);
                    mInternalAbuseTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
                    updateButtonState(); 
                } 
            } 
Contextual code suggestions in your IDE  Get Codota for Java