0

the list has two names (Diego and Alan) it always shows Diego first I have already tried many different things but none of them seems to work

public void mostrarusuarios() {
    inicializarbase();
    if (responder == true) {
        Cursor cursor = basededatos.rawQuery("select * from Usuarios ", null);

        if (cursor.moveToFirst()) {
            listusers.add(cursor.getString(cursor.getColumnIndex("User")));
            while (cursor.moveToNext()) {
                listusers.add(cursor.getString(cursor.getColumnIndex("User")));
            }
        }
    }
    for (int i = 0; i < listusers.size(); i++) {
        Toast.makeText(this, listusers.get(i), Toast.LENGTH_SHORT).show();
    }
    basededatos.close();
}

public void orderalphabetically() {
    showusers();
    Collections.sort(listusers, String.CASE_INSENSITIVE_ORDER);
    for (int i = 0; i < listusers.size(); i++) {
        Toast.makeText(this, listusers.get(i), Toast.LENGTH_SHORT).show();
    }
}
Elliott Frisch
  • 198,278
  • 20
  • 158
  • 249

0 Answers0