の番号から連絡先の名前を取得する2.3.4 Androidの番号を使用して連絡先の名前を取得しようとしましたが、動作していませんでした。ここに私のコードが添付されています。親切..私はスタックに掲載さエミュレータでは、流れの上にその作業を非常に多くの方法を試みたが、電話でのラン..Android 2.3.4
String[] projection = new String[] { Contacts.Phones.DISPLAY_NAME,
Contacts.Phones.NUMBER };
// encode the phone number and build the filter URI
Toast.makeText(context, "sender: "+sender, Toast.LENGTH_LONG).show();
Uri contactUri = Uri.withAppendedPath(Contacts.Phones.CONTENT_FILTER_URL,
Uri.encode(sender));
// query time
Cursor c = context.getContentResolver().query(contactUri, projection, null,
null, null);
// if the query returns 1 or more results
// return the first result
if(c.getCount()>0){
if (c.moveToFirst()) {
name = c.getString(c.getColumnIndex(Contacts.Phones.DISPLAY_NAME));
}
}else{
name="UnKnown";
}
完全なコードを投稿してください。 – swathi