是否有意为特定人员发起通话记录和联系人?

时间:2012-02-24 01:56:34

标签: android android-intent contacts android-activity

我有联系人的电话号码和姓名。有了这些信息,我该如何启动联系人:

  1. 通话记录详细信息活动
  2. 编辑联系人活动
  3. 我只能启动通话记录和通讯录的启动活动。相反,我想直接导航到一个人的记录。知道如何实现这个目标吗?

1 个答案:

答案 0 :(得分:0)

这对我来说很好。请看一下。

   contactNumber = Uri.encode(contactNumber);

   int phoneCallLogID = new Random().nextInt();
   Cursor callLogLookupCursor = context.getContentResolver().query(Uri.withAppendedPath(android.provider.CallLog.Calls.CONTENT_FILTER_URI,contactNumber),null, null, null, null);
       while(callLogLookupCursor.moveToNext()){
           phoneCallLogID = callLogLookupCursor.getInt(callLogLookupCursor.getColumnIndexOrThrow(CallLog.Calls._ID));

           }
       callLogLookupCursor.close();
        Uri uri = Uri.withAppendedPath(
                android.provider.CallLog.Calls.CONTENT_URI, String.valueOf(phoneCallLogID));



   Intent intent = new Intent(Intent.ACTION_VIEW);
   intent.setData(uri);
   startActivityForResult(intent,0);