`i want distinct value.This Method gives me same value again and again. Any suggestions ? people
ArrayList<String> getNumberFromNote(String note) {
Cursor cursor;
mDbHelper = mSqliteHelper.getReadableDatabase();
String whereClause = SqliteHelpers.NUMBER_COLUMN +" = ?";
String[] whereArgs = new String[] {note};
cursor = mDbHelper.query(SqliteHelpers.TABLE_NAME, null, whereClause, whereArgs,
null, null, null);
ArrayList<String> arrayList = new ArrayList<>();
while (cursor.moveToNext()) {
String itemname = cursor.getString(cursor.getColumnIndex(
SqliteHelpers.NUMBER_COLUMN));
if (itemname != null) {
arrayList.add(itemname);
System.out.println(itemname);
}
}
return arrayList;
}
Aucun commentaire:
Enregistrer un commentaire