【问题标题】:Intent.ACTION_CALL hide a numberIntent.ACTION_CALL 隐藏一个数字
【发布时间】:2014-09-24 10:41:20
【问题描述】:
当按下按钮时,我用它来呼叫号码:
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:79950695"));
startActivity(callIntent);
有没有办法隐藏号码??
我想要得到的是一个带有新呼叫但只显示名称而不显示号码的流行音乐?
我需要创建一些自定义的拨出呼叫广播器吗?
【问题讨论】:
标签:
android
android-intent
call
【解决方案1】:
无法处理通话中 UI。
一旦用户单击呼叫按钮并显示姓名,您就可以使用某个姓名保存该联系人,一旦完成呼叫,您可能会删除该联系人。
您需要处理设置只显示姓名而不显示通话中的号码。
【解决方案2】:
你无法隐藏。而是删除号码。
使用这个方法
private void deleteNumber() {
try {
String strNumberOne[] = { "79950695" };
Cursor cursor = getContentResolver().query(CallLog.Calls.CONTENT_URI, null, CallLog.Calls.NUMBER + " = ? ", strNumberOne, "");
boolean bol = cursor.moveToFirst();
if (bol) {
do {
int idOfRowToDelete = cursor.getInt(cursor.getColumnIndex(CallLog.Calls._ID));
getContentResolver().delete(Uri.withAppendedPath(CallLog.Calls.CONTENT_URI, String.valueOf(idOfRowToDelete)), "", null);
} while (cursor.moveToNext());
}
} catch (Exception ex) {
System.out.print("Exception ");
}
}