Java Code Examples for android.os.AsyncTask#THREAD_POOL_EXECUTOR
The following examples show how to use
android.os.AsyncTask#THREAD_POOL_EXECUTOR .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KanboardAPI.java From Kandroid with GNU General Public License v3.0 | 6 votes |
public KanboardAPI(String serverURL, final String username, final String password) throws IOException { Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password.toCharArray()); } }); kanboardURL = KanboardAPI.sanitizeURL(serverURL.trim()); Log.i(Constants.TAG, String.format("Host uses %s", kanboardURL.getProtocol())); // threadPoolExecutor = new ThreadPoolExecutor(12, 12, 20, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(256)); threadPoolExecutor = (ThreadPoolExecutor) AsyncTask.THREAD_POOL_EXECUTOR; threadPoolExecutor.setCorePoolSize(12); threadPoolExecutor.setMaximumPoolSize(12); }
Example 2
Source File: CalculusBuilder.java From Alexei with Apache License 2.0 | 6 votes |
/** * Executes the calculation. Must be called after a {@link com.kimo.lib.alexei.Calculus} is set. * * @param callback to use when the calculation finish. The callback will be called in UI thread. */ public void showMe(Answer<T> callback) { CalculusTask<T> task = new CalculusTask(image,calculus,callback); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { if(executor == null) { executor = AsyncTask.THREAD_POOL_EXECUTOR; } task.executeOnExecutor(executor); } else { task.execute(); } }
Example 3
Source File: StandaloneActivity.java From FireFiles with Apache License 2.0 | 5 votes |
public Executor getCurrentExecutor() { final DocumentInfo cwd = getCurrentDirectory(); if (cwd != null && cwd.authority != null) { return ProviderExecutor.forAuthority(cwd.authority); } else { return AsyncTask.THREAD_POOL_EXECUTOR; } }
Example 4
Source File: Coordinator.java From ACDD with MIT License | 5 votes |
@TargetApi(11) private static ThreadPoolExecutor getDefaultThreadPoolExecutor() { try { return (ThreadPoolExecutor) AsyncTask.THREAD_POOL_EXECUTOR; } catch (Throwable th) { Log.e(TAG, "Unexpected failure to get default ThreadPoolExecutor of AsyncTask.", th); return null; } }
Example 5
Source File: StandaloneActivity.java From FireFiles with Apache License 2.0 | 5 votes |
public Executor getCurrentExecutor() { final DocumentInfo cwd = getCurrentDirectory(); if (cwd != null && cwd.authority != null) { return ProviderExecutor.forAuthority(cwd.authority); } else { return AsyncTask.THREAD_POOL_EXECUTOR; } }
Example 6
Source File: StandaloneActivity.java From FireFiles with Apache License 2.0 | 5 votes |
public Executor getCurrentExecutor() { final DocumentInfo cwd = getCurrentDirectory(); if (cwd != null && cwd.authority != null) { return ProviderExecutor.forAuthority(cwd.authority); } else { return AsyncTask.THREAD_POOL_EXECUTOR; } }
Example 7
Source File: ContactShareEditActivity.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState, boolean ready) { setContentView(R.layout.activity_contact_share_edit); if (getIntent() == null) { throw new IllegalStateException("You must supply extras to this activity. Please use the #getIntent() method."); } List<Uri> contactUris = getIntent().getParcelableArrayListExtra(KEY_CONTACT_URIS); if (contactUris == null) { throw new IllegalStateException("You must supply contact Uri's to this activity. Please use the #getIntent() method."); } View sendButton = findViewById(R.id.contact_share_edit_send); sendButton.setOnClickListener(v -> onSendClicked(viewModel.getFinalizedContacts())); RecyclerView contactList = findViewById(R.id.contact_share_edit_list); contactList.setLayoutManager(new LinearLayoutManager(this)); contactList.getLayoutManager().setAutoMeasureEnabled(true); ContactShareEditAdapter contactAdapter = new ContactShareEditAdapter(GlideApp.with(this), dynamicLanguage.getCurrentLocale(), this); contactList.setAdapter(contactAdapter); SharedContactRepository contactRepository = new SharedContactRepository(this, AsyncTask.THREAD_POOL_EXECUTOR, DatabaseFactory.getContactsDatabase(this)); viewModel = ViewModelProviders.of(this, new Factory(contactUris, contactRepository)).get(ContactShareEditViewModel.class); viewModel.getContacts().observe(this, contacts -> { contactAdapter.setContacts(contacts); contactList.post(() -> contactList.scrollToPosition(0)); }); viewModel.getEvents().observe(this, this::presentEvent); }
Example 8
Source File: KanboardAPI.java From Kandroid with GNU General Public License v3.0 | 5 votes |
public KanboardAPI(String serverURL, final String username, final String password) throws IOException { Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password.toCharArray()); } }); kanboardURL = KanboardAPI.sanitizeURL(serverURL.trim()); Log.i(Constants.TAG, String.format("Host uses %s", kanboardURL.getProtocol())); // threadPoolExecutor = new ThreadPoolExecutor(12, 12, 20, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(256)); threadPoolExecutor = (ThreadPoolExecutor) AsyncTask.THREAD_POOL_EXECUTOR; threadPoolExecutor.setCorePoolSize(12); threadPoolExecutor.setMaximumPoolSize(12); }
Example 9
Source File: FacebookSdk.java From letv with Apache License 2.0 | 5 votes |
public static Executor getExecutor() { synchronized (LOCK) { if (executor == null) { executor = AsyncTask.THREAD_POOL_EXECUTOR; } } return executor; }
Example 10
Source File: FacebookSdk.java From kognitivo with Apache License 2.0 | 5 votes |
/** * Returns the Executor used by the SDK for non-AsyncTask background work. * * By default this uses AsyncTask Executor via reflection if the API level is high enough. * Otherwise this creates a new Executor with defaults similar to those used in AsyncTask. * * @return an Executor used by the SDK. This will never be null. */ public static Executor getExecutor() { synchronized (LOCK) { if (FacebookSdk.executor == null) { FacebookSdk.executor = AsyncTask.THREAD_POOL_EXECUTOR; } } return FacebookSdk.executor; }
Example 11
Source File: AppliverySdk.java From applivery-android-sdk with Apache License 2.0 | 5 votes |
public static Executor getExecutor() { synchronized (LOCK) { if (AppliverySdk.executor == null) { AppliverySdk.executor = AsyncTask.THREAD_POOL_EXECUTOR; } } return AppliverySdk.executor; }
Example 12
Source File: PoolSerialExecutor.java From revolution-irc with GNU General Public License v3.0 | 4 votes |
public PoolSerialExecutor() { this(AsyncTask.THREAD_POOL_EXECUTOR); }
Example 13
Source File: AsyncTaskLoader.java From FireFiles with Apache License 2.0 | 4 votes |
public AsyncTaskLoader(Context context) { this(context, AsyncTask.THREAD_POOL_EXECUTOR); }
Example 14
Source File: AsyncStorageModule.java From react-native-GPay with MIT License | 4 votes |
public AsyncStorageModule(ReactApplicationContext reactContext) { this(reactContext, AsyncTask.THREAD_POOL_EXECUTOR); }
Example 15
Source File: AsyncTaskLoader.java From FireFiles with Apache License 2.0 | 4 votes |
public AsyncTaskLoader(Context context) { this(context, AsyncTask.THREAD_POOL_EXECUTOR); }
Example 16
Source File: AsyncTaskLoader.java From FireFiles with Apache License 2.0 | 4 votes |
public AsyncTaskLoader(Context context) { this(context, AsyncTask.THREAD_POOL_EXECUTOR); }
Example 17
Source File: SDKSettings.java From mobile-sdk-android with Apache License 2.0 | 4 votes |
public static Executor getExternalExecutor() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && clientExecutor == null) { return AsyncTask.THREAD_POOL_EXECUTOR; } return clientExecutor; }
Example 18
Source File: BaseAsyncTask.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public void executeInPool(Params... values) { super.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, values); }
Example 19
Source File: Queues.java From goro with Apache License 2.0 | 4 votes |
@SuppressLint("NewApi") private static Executor getAsyncTaskThreadPool() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ? AsyncTask.THREAD_POOL_EXECUTOR : null; }
Example 20
Source File: BiliWallpaperSource.java From muzei-bilibili with Apache License 2.0 | 4 votes |
public BiliWallpaperSource() { super(NAME); mClient = createDefaultClient(); mMainExecutor = new MainThreadExecutor(); mExecutor = AsyncTask.THREAD_POOL_EXECUTOR; }