【问题标题】:Launch the Android dialer with a specific number使用特定号码启动 Android 拨号器
【发布时间】:2011-11-08 23:58:03
【问题描述】:

我的代码运行良好,但它所做的只是启动拨号程序。我想要它做的是能够使用特定号码启动拨号器。我该怎么做?

bu5.setOnClickListener(new OnClickListener() {

    public void onClick(View v) {
        //open the phone dialer on clicking the button
        Intent intent = new Intent(Intent.ACTION_DIAL);
        startActivity(intent);   
    }
}); 

【问题讨论】:

    标签: android android-intent phone-number phone-call


    【解决方案1】:

    您需要将带有数字的 tel: uri 设置为 Intent,将其添加到 startActivity 行之前。

    intent.setData(Uri.parse("tel:1231231234"));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-28
      • 2016-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多