Привет Пожалуйста, попробуйте ниже код.
public int GetUserData(Context context,String tablename)
{
int app_id=0;
try {
sampleDB = myDbHelper.openDataBase();
} catch (SQLException sqle) {
throw sqle;
}
sampleDB = myDbHelper.getWritableDatabase();
c = sampleDB.rawQuery("SELECT * FROM " +
tablename, null);
if(c!=null)
{
if(c.moveToFirst())
{
do
{
app_id=c.getInt(c.getColumnIndex("app_id"));
}while(c.moveToNext());
}
}
return app_id;
}