This is the retriver method:
public Cursor getData(String subj) {
String selectQuery = "SELECT " + subj + " FROM " + TABLE_PRIMEIRO;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
if(cursor != null){
cursor.moveToFirst();
}
return cursor;
}
This is how I'm displaying it in a TextView:
Cursor cursor = db.getData("columnname");
cursor.moveToFirst();
String dataget = cursor.getString(cursor.getColumnIndex("columnname"));
if (dataget!= null){
textView1.setText(dataget);
}
The app is made for API 23+, this code works fine on the API 23 emulator and on my own cellphone (which has Android 7.1) but it does not work on other cellphones. (Android 7.0 and 6.0).