0
I have the following code and would like to make an ORDER BY name:
try {
String clsSimPhonename = null;
String clsSimphoneNo = null;
Uri simUri = Uri.parse("content://icc/adn");
Cursor cursorSim = getContentResolver().query(simUri, null,
null, null, "name ASC");
while (cursorSim.moveToNext()) {
clsSimPhonename = cursorSim.getString(cursorSim
.getColumnIndex("name"));
clsSimphoneNo = cursorSim.getString(cursorSim
.getColumnIndex("number"));
}
} catch (Exception e) {
e.printStackTrace();
}
i did Cursor cursorSim = getContentResolver(). query(simUri, null, null, null, Phone.DISPLAY_NAME + "ASC"); and did not change anything.
– Pedro Rangel
Oops, I missed. Try using
"name ASC"
, this would be thedisplay_name
and not thename
how you’re using and I haven’t noticed.– Paulo Rodrigues
I had already tested this also did not work.
– Pedro Rangel
Within that very
while
You tried printing on the console to see if it’s coming in order at least this stretch? What do you do with these two variables later? The problem may be later yet.– Paulo Rodrigues
while inside did ... Toast.makeText(this, clsSimPhonename, Toast.LENGTH_SHORT). show(); only that and not ordering by contact name.
– Pedro Rangel
Is it possible to list some items, the ones that are sorted wrong? Are there cases of upper/lower case? We have already done what was necessary, I do not know what can be. (With
System.out.println()
you can see easier on the console.)– Paulo Rodrigues
I’ll see Dad doing the tests on my phone... I’ll see if I can get in the emulator and print but I think there’s no card^^
– Pedro Rangel
All contact names start with uppercase letter...
– Pedro Rangel
I printed it out ....
– Pedro Rangel
check out this site http://www.frameworksystem.com/blog/mobile-lendo-contactlists-do-android/ I’ve already run the test with the mobile contacts without being from the sim card and order it legal... the problem is only in the ordering of the sim card contacts
– Pedro Rangel
if you own an android phone try to test to see if in your order.
– Pedro Rangel
Let’s go continue this discussão in chat.
– Paulo Rodrigues