1
private ArrayList<String> mArrayList = new ArrayList<String>();

    mArrayList.clear();

    mArrayList.add("test 3");
    mArrayList.add("test 21");
    mArrayList.add("test 4");
    mArrayList.add("test 6");
    mArrayList.add("test 1");

    Collections.sort(mArrayList);

    for (int i = 0; i < mArrayList.size(); i++) {

        Log.e("TAG", "" + mArrayList.get(i));
    }

結果は次のとおりです。

test 1
test 21
test 3
test 4
test 6

でも私はしたい:

test 1
test 3
test 4
test 6
test 21

私はそれを並べ替えましたが、完全ではありません。それを行う方法はわかりません。何か考えがあれば、私と共有してください。

4

1 に答える 1