I have been trying to find something that can help me to retrieve SQLite database row when I click on the gridview image ! Like when I click the first image on the new activity it shows me some data related to that image which is saved in the database.
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent(mContext,HeroData.class);
intent.putExtra("imageID", mThumbIds[position]);
mContext.startActivity(intent);
}
This is how I'm starting a new activity and putting the image which I click, now I need to know how to get a SQL database row which has some data related to that image.
public Cursor getTestData()
{
try
{
String sql ="SELECT * FROM Heroes";
Cursor mCur = mDb.rawQuery(sql, null);
if (mCur!=null)
{
mCur.moveToNext();
}
return mCur;
}
catch (SQLException mSQLException)
{
Log.e(TAG, "getTestData >>"+ mSQLException.toString());
throw mSQLException;
}
}
the above is the cursor to get all data, but i want only one row.