0
I’m not getting the phone number to add to my list, someone knows?
public void pegarContatos() {
Uri agenda = ContactsContract.Contacts.CONTENT_URI;
Cursor cursor = getContentResolver().query(agenda, null, null, null, null);
while (cursor.moveToNext()) {
int telefone = cursor.getInt(cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));
if(telefone == 1) {
int ID = cursor.getColumnIndex(ContactsContract.Contacts._ID);
String nome = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
Contato contato = new Contato(ID ,nome);
listaDeContatos.add(contato);
}
}
this.lista();
cursor.close();
}
Dude, could you explain to me what each line does? I’m doing a survey and I don’t think so.. I wanted to understand the function of each line....
– Alisson Hoepers