Q:

Android: How to return a string from Cursor adapter

My aim for my app is to show a list of modules which is pulled from a SQLite database.  If a user clicks a particular module a new activity begins which gives further information stored within the database related to that one particular module. 
What I was hoping to do was get the row id and send this in an intent however, I'm unsure how to get the row id from a cursor adapter into an onClickListItem?  Any suggestions would be much appreciated. 
Cursor Adapter
public class TestCursorAdapter extends CursorAdapter {

    private LayoutInflater viewInflater;
    public TestCursorAdapter(Context context, Cursor c, int flags) {
        super(context, c, flags);
        // TODO Auto-generated constructor stub
        viewInflater = (LayoutInflater) context.getSystemService(Context. LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public void bindView(View v, Context context, Cursor c) 
    {
        TextView text_modulecode = (TextView)v.findViewById(R.id.labelModuleCode);
        TextView text_modulename = (TextView)v.findViewById(R.id.labelModuleName);

        text_modulecode.setText(c.getString(c.getColumnIndex(database. KEY_MODULECODE)));
        text_modulename.setText(c.getString(c.getColumnIndex(database. KEY_MODULENAME)));

        String moduleId = c.getString(c.getColumnIndex(database. KEY_ROWID));
    }

    @Override
    public View newView(Context context, Cursor c, ViewGroup parent) {
        View v = viewInflater.inflate(R.layout.listcourses, parent, false);
        return v;
    }
}

From main activity
public void onListItemClick(ListView l, View v, int position, long id)
      {
          super.onListItemClick(l, v, position, id);
            Intent intent = new Intent(this,ViewCourse.class);

            //--->             <--
            intent.putExtra(TEST,moduleId);
            startActivity(intent);
      }

A:

Take a look at the arguments of onListItemClick
public void onListItemClick(ListView l, View v, int position, long id)

ID is there.. This is automatically populated with the row ID by the cursor adapter.. 

