Bry*_*yan 6 android asynctaskloader
我正在尝试将params传递给AsyncTaskLoader.我怎么做?
目前,我正在将我需要传递的内容放在一个单独的静态类中.无论如何围绕这个?
public class NewsAsyncTaskLoader extends AsyncTaskLoader<List<Content>> {
private static final DbHelper dbHelper = DbHelperFactory.getDbHelper();
public FeedAsyncTaskLoader(Context context) {
super(context);
}
@Override
public List<Content> loadInBackground() {
List<Content> contents = DbHelper.getStream(FeedSections.getInstance().getCurrentSection());
feed.setContents(contents);
return feed;
}
}
Run Code Online (Sandbox Code Playgroud)
ian*_*ake 18
将其他参数传递给构造函数:
public FeedAsyncTaskLoader(Context context, String moreInfo) {
super(context);
// Do something with moreInfo
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3851 次 |
| 最近记录: |