在我的平板电脑应用中,我在一个活动中使用了彼此相邻的许多 Fragments (一个类),在这个Fragment类中我有:
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getLoaderManager().initLoader(this.position, null, this);
}
和
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
Uri uri = Uri.withAppendedPath(...)
return new CursorLoader(getActivity(), uri, proj, null, null, "distance");
}
每个片段为 CursorLoader 启动新工作线程。这个规模有多远?
答案 0 :(得分:2)
没有硬限制。但是,如果您担心要启动的线程数,请使用AsyncTask,因为其doInBackground
方法在后台线程池中运行。更多信息