This actually happens because usually getView()
processes rows in an order that Android determines. Many people think this is called sequentially and it's not, it's called within an order that establishes the Adapter
.
You can, however, override this behavior. In that case, you could simply declare a Comparator
. For instance, if the content of your rows are strings, this would be one way:
Comparator alphabeticalOrder = new Comparator<String>() {
public int compare(final String str1, final String str2) {
return str1.compareToIgnoreCase(str2);
};
};
Afterwards, you simply set it on your Adapter
.
adapter.sort(alphabeticalOrder);