这是RxJava for Android App Development book, p.20 使用RxJava和Loader的代码。什么类型应该是mLoaderManager以及如何声明它?
private static class LoaderInitOnSubscribe implements Observable.OnSubscribe<Story> {
//...
@Override
public void call(final Subscriber<? super Story> subscriber) {
mLoaderManager.initLoader(LOADER_ID, mLoaderArgs, new LoaderCallbacks<Story>() {
@Override
public Loader<Story> onCreateLoader(int id, Bundleargs) {
return new StoryLoader(mContext);
}
@Override
public void onLoadFinished(Loader<Story> loader, Story data) {
subscriber.onNext(data);
}
@Override
public void onLoaderReset(Loader<Story> loader) {}
});
}}
答案 0 :(得分:0)
drinks = []
for x in df1.Model:
for y in df2.Model:
for j in df1.Color:
for k in df2.Color:
if x == y and j == k:
drinks.append(df2.loc[df2['Model'] == x, 'Drink'].iloc[0])
来自['Soda', 'Soda', 'Soda', 'Soda', 'Soda', 'Soda', 'Water', 'Water', 'Water']
来自getLoaderManager()
或来自LoaderManager
来自getLoaderManager()
。