Ribin Haridas
Ribin Haridas

Reputation: 1620

android.os.AsyncTask.THREAD_POOL_EXECUTOR

09-22 15:18:06.343: E/AndroidRuntime(374): java.lang.NoSuchFieldError: android.os.AsyncTask.THREAD_POOL_EXECUTOR

This error occurs when doing this code

    SetHoliday holi = new SetHoliday();// asynchronous task

        SetAbsent abs = new SetAbsent(); // asynchronous task


        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB) {
            holi.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, Selected);
            abs.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, Selected);

        } else {
            holi.execute(Selected);
            abs.execute(Selected);
        }

I want to execute the asynchronous task parallely in api level below 11 But Threadpoolexecuter is not found in this apis Please help me

Upvotes: 1

Views: 1616

Answers (1)

laalto
laalto

Reputation: 152867

The default executor for an asynctask changed from parallel to serial in API 11, so a regular execute() will run the asynctasks in parallel in API levels below 11.

You may want to switch the <= to >= to make the code work.

Upvotes: 1

Related Questions