【问题标题】:How to write a phone number for calling in android but not make the call如何在android中编写电话号码以拨打电话但不拨打电话
【发布时间】:2015-03-18 13:18:48
【问题描述】:

我希望在某些活动中单击某个按钮上的操作,该按钮仅在议程屏幕中写入电话号码,但不调用它。我必须让用户决定他是否想打电话。

我现在发现的是这段代码,它运行良好,但它并不是我真正需要的。使用此代码,当我单击按钮时,它会调用所选的

private OnClickListener callToAction = new OnClickListener() {

    @Override
    public void onClick(View v) {
        Log.d(TAG, "onClick sticky from homepage.");
        Intent callIntent = new Intent(Intent.ACTION_CALL);
        callIntent.setData(Uri.parse("tel:*123"));
        startActivity(callIntent);
    }
};

【问题讨论】:

    标签: java android phone-number phone-call


    【解决方案1】:

    使用Intent.ACTION_DIAL打开拨号器,而不是接听电话。

    【讨论】:

    • 非常感谢,就是这样!
    【解决方案2】:

    您需要为此使用其他 Intent Action。
    试试Intent.ACTION_DIAL http://developer.android.com/reference/android/content/Intent.html#ACTION_DIAL
    Intent.ACTION_VIEW http://developer.android.com/reference/android/content/Intent.html#ACTION_VIEW

    Intent 文档示例:

    ACTION_VIEW tel:123 -- 显示填写了给定号码的电话拨号器。注意 VIEW 操作如何执行被认为对特定 URI 最合理的事情。 ACTION_DIAL tel:123 -- 显示填写给定号码的电话拨号器。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-03-09
      • 1970-01-01
      • 2016-03-26
      • 1970-01-01
      • 2017-12-21
      • 1970-01-01
      相关资源
      最近更新 更多