How many Worker Threads can be created at most?
-
28-02-2021 - |
Question
In my tablet app I use many Fragments (of one class) next to eachother in one activity, and in this Fragment class I have:
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getLoaderManager().initLoader(this.position, null, this);
}
and
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
Uri uri = Uri.withAppendedPath(...)
return new CursorLoader(getActivity(), uri, proj, null, null, "distance");
}
Each Fragment starts a new worker thread for a CursorLoader. How far does this scale?
Solution
There is no hard limit. However, if you are concerned about the number of threads you are starting, use AsyncTask as its doInBackground
method runs in a pool of background threads. More information
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow