本文整理匯總了Java中android.app.LoaderManager.LoaderCallbacks類的典型用法代碼示例。如果您正苦於以下問題:Java LoaderCallbacks類的具體用法?Java LoaderCallbacks怎麽用?Java LoaderCallbacks使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
LoaderCallbacks類屬於android.app.LoaderManager包,在下文中一共展示了LoaderCallbacks類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onActivityCreated
import android.app.LoaderManager.LoaderCallbacks; //導入依賴的package包/類
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final Context context = getActivity();
mAdapter = new DocumentStackAdapter();
mListView.setAdapter(mAdapter);
final RootsCache roots = DocumentsApplication.getRootsCache(context);
final State state = ((BaseActivity) getActivity()).getDisplayState();
mCallbacks = new LoaderCallbacks<List<DocumentStack>>() {
@Override
public Loader<List<DocumentStack>> onCreateLoader(int id, Bundle args) {
return new RecentsCreateLoader(context, roots, state);
}
@Override
public void onLoadFinished(
Loader<List<DocumentStack>> loader, List<DocumentStack> data) {
mAdapter.swapStacks(data);
if (isResumed()) {
setListShown(true);
} else {
setListShownNoAnimation(true);
}
// When launched into empty recents, show drawer
if (mAdapter.isEmpty() && !state.stackTouched) {
((BaseActivity) context).setRootsDrawerOpen(true);
}
}
@Override
public void onLoaderReset(Loader<List<DocumentStack>> loader) {
mAdapter.swapStacks(null);
}
};
setListAdapter(mAdapter);
setListShown(false);
getLoaderManager().restartLoader(LOADER_RECENTS, getArguments(), mCallbacks);
}
示例2: onActivityCreated
import android.app.LoaderManager.LoaderCallbacks; //導入依賴的package包/類
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if(null != savedInstanceState) {
group_size = savedInstanceState.getInt(GROUP_SIZE, 0);
expandedIds = (ArrayList<Long>) savedInstanceState.getSerializable(GROUP_IDS);
}
final Context context = getActivity();
final RootsCache roots = DocumentsApplication.getRootsCache(context);
final State state = ((BaseActivity) context).getDisplayState();
mCallbacks = new LoaderCallbacks<Collection<RootInfo>>() {
@Override
public Loader<Collection<RootInfo>> onCreateLoader(int id, Bundle args) {
return new RootsLoader(context, roots, state);
}
@Override
public void onLoadFinished(
Loader<Collection<RootInfo>> loader, Collection<RootInfo> result) {
if (!isAdded()) return;
final Intent includeApps = getArguments().getParcelable(EXTRA_INCLUDE_APPS);
if (mAdapter == null) {
mAdapter = new RootsExpandableAdapter(context, result, includeApps);
Parcelable state = mList.onSaveInstanceState();
mList.setAdapter(mAdapter);
mList.onRestoreInstanceState(state);
} else {
mAdapter.setData(result);
}
int groupCount = mAdapter.getGroupCount();
if(group_size != 0 && group_size == groupCount){
if (expandedIds != null) {
restoreExpandedState(expandedIds);
}
} else {
group_size = groupCount;
for (int i = 0; i < group_size; i++) {
mList.expandGroup(i);
}
expandedIds = getExpandedIds();
mList.setOnGroupExpandListener(mOnGroupExpandListener);
mList.setOnGroupCollapseListener(mOnGroupCollapseListener);
}
}
@Override
public void onLoaderReset(Loader<Collection<RootInfo>> loader) {
mAdapter = null;
mList.setAdapter((RootsExpandableAdapter)null);
}
};
}
示例3: initialiseExistingFormList
import android.app.LoaderManager.LoaderCallbacks; //導入依賴的package包/類
private void initialiseExistingFormList() {
FormAdapter adapter = new FormAdapter(this.getApplicationContext(), null, this);
setListAdapter(adapter);
getLoaderManager().initLoader(0, null, (LoaderCallbacks<Cursor>) this);
}
示例4: execute
import android.app.LoaderManager.LoaderCallbacks; //導入依賴的package包/類
@Override
public void execute(final Query request, final QueryListener listener) {
final LoaderCallbacks<?> callbacks = new QueryLoaderCallbacks(listener);
execute(request, callbacks);
}