简体   繁体   English

Intent.ACTION_CALL隐藏一个数字

[英]Intent.ACTION_CALL hide a number

I use this to call a number when button is pressed: 当按下按钮时,我用它来拨打电话:

 Intent callIntent = new Intent(Intent.ACTION_CALL);                
 callIntent.setData(Uri.parse("tel:79950695"));                 
 startActivity(callIntent);

Is there a way to hide the number ?? 有没有办法隐藏数字? What I want to get is a pop with new call but showing only the name without the number ? 我想要得到的是带有新呼叫的弹出菜单,但仅显示名称而不显示数字? Would I need to create some custom Outgoing Call Broadcaster ? 我是否需要创建一些自定义的去电广播器?

It is not possible to handle In Call UI. 无法处理“通话中” UI。 you can save that contact with some name once user clicks on call button and display the name, once done with call you might delete that contact. 您可以在用户单击“呼叫”按钮并显示姓名后,用该名称保存该联系人,完成通话后,您可能会删除该联系人。

You need to handle the settings to display only name but not number in call. 您需要处理设置以仅显示姓名,而不显示呼叫中的号码。

You can't hide. 你不能躲藏 Instead delete the number. 而是删除该号码。

Use this method 使用这个方法

   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 ");
        }
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM