private SimpleCursorAdapter mAdapter;
private static final String[] PROJECTION = new String[] { "_id", "stitchname" };
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Intent myData = getActivity().getIntent();
Bundle info = myData.getExtras();
String[] dataColumns = { "stitchname" };
int[] viewIDs = { R.id.stitchlist1 };
mAdapter = new SimpleCursorAdapter(getActivity(), R.layout.stitchlist, null, dataColumns, viewIDs, 0);
setListAdapter(mAdapter);
getLoaderManager().initLoader(0, info, (LoaderCallbacks<Cursor>) this);
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
String selection = "stitchlevel=?";
String[] selectionArgs = new String[] {args.getString("Level")};
return (Loader<Cursor>) new CursorLoader(getActivity(), STITCHES_URI,
PROJECTION, selection, selectionArgs, null);
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
mAdapter.swapCursor((android.database.Cursor) cursor);
}