(ОБНОВЛЕНИЕ) Это работает на эмуляторе, но не на моей легенде HTC: (
У меня есть следующий метод в моем ListActivity, и он не возвращает никаких значений в Курсор (getCount = 0)
Я не могу понять почему. Неважно, на какой контакт я нажимаю в моем списке.
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
Log.d(TAG,"onListItemClick");
//get Telephone number for entry and display in Toast
Uri phoneUri = ContentUris.withAppendedId(Phone.CONTENT_URI, id);
Log.d(TAG,String.valueOf(phoneUri));
String[] projection = new String[]{Phone.NUMBER};
//Get Cursor
Cursor phoneCursor = managedQuery(phoneUri, projection, null, null, null);
while(phoneCursor.moveToNext()){
String dspNumber;
String number = phoneCursor.getString(phoneCursor.getColumnIndexOrThrow(Phone.NUMBER));
if(number==""){
dspNumber = "No number found";
}else{
dspNumber = number;
}
Toast.makeText(this,dspNumber, 3000).show();
}
}