Hi - I have a ListFragment that is populated using a CursorLoader. Once the ListFragment is populated, I have an OnItemClickListener method in which I want to identify which item from the List Fragment the user chose. How do I do this? I've tried:
String item = getListAdapter().getItem(position);
String item = getListAdapter().getItem(position).toString();
String item = (String) ((Fragment) getListAdapter().getItem(position)).getString(0);
Where position is an integer passed to the onClickItemListener method like so:
public void onListItemClick(ListView l, View v, int position, long id)
All of these throw Cast Exceptions of one type or another. I'm stumped. This seems like a simple thing to do. For your reference, here's how the List Fragment is populated:
private SimpleCursorAdapter mAdapter;
private static final String[] PROJECTION = new String[] { "_id", "stitchname" };
 public void onActivityCreated(Bundle 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);
  getLoaderManager().initLoader(0, info, (LoaderCallbacks<Cursor>) this); 
 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); 
 public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
         mAdapter.swapCursor((android.database.Cursor) cursor);
Any suggestions would be most welcome, thanks!