为什么赢得了我的arraylist排序工作?

时间:2017-06-13 00:27:28

标签: java android sqlite arraylist

这个名单有两个名字(迭戈和艾伦),它总是先显示迭戈 我已经尝试了许多不同的东西,但它们似乎都没有工作

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();
    }
}

0 个答案:

没有答案