【问题标题】:How can I call a phone number through my android app?如何通过我的安卓应用拨打电话号码?
【发布时间】:2015-10-22 03:32:09
【问题描述】:

我制作了一个简单的应用程序,其中包含列表视图中的紧急电话号码,我想要做的是当我点击列表视图中的联系人时,我可以拨打电话号码

【问题讨论】:

标签: android android-activity android-studio


【解决方案1】:

在按钮上写下点击

    String number = "123456789";//mobile number
    Intent intent = new Intent(Intent.ACTION_CALL);
    intent.setData(Uri.parse("tel:" +number));
    startActivity(intent)

【讨论】:

    【解决方案2】:

    这是一个关于如何拨打电话号码 123456789 的示例。

    Intent intent = new Intent(Intent.ACTION_CALL);
    intent.setData(Uri.parse("tel:123456789"));
    startActivity(intent);
    

    只需将它放在您的 listView 的 OnItemClickListener() 方法中。 希望对您有所帮助。

    【讨论】:

      【解决方案3】:
       String mono = "9876543210";//mobile number
          Intent intent = new Intent(Intent.ACTION_CALL);
          intent.setData(Uri.parse("tel:" +mono));
          startActivity(intent);
      

      在清单集权限 CALL_PHONE

      【讨论】:

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