简体   繁体   English

如何通过我的android应用拨打电话号码?

[英]How can I call a phone number through my android app?

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

This is an example about how you can call to number 123456789. 这是一个有关如何拨打号码123456789的示例。

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

Just put it in OnItemClickListener() method of your listView. 只需将其放在listView的OnItemClickListener()方法中即可。 Hope that will help you out. 希望对您有所帮助。

write under button onclick 在按钮onclick下写

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

in Manifest set permission CALL_PHONE 在清单设置权限CALL_PHONE中

暂无
暂无

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

相关问题 如何将更新的电话号码放入为Android应用程序选择的字段? - How can I put the updated phone number into the field I picked for my Android app? Android - 当通过我的应用程序拨打电话时隐藏呼叫电话号码? - Android - Hide calling phone number when call is made through my app? 我希望我的Android应用程序在手机接到电话并获取来电号码时启动 - I want my android app to start when a phone receives a call and to get the incoming phone number 如何以编程方式获取运行我的Android应用程序的设备的电话号码? - How can I programmatically get the phone number of the device that is running my android app? 如何通过 Android 电话访问我的本地主机? - How can I access my localhost through Android phone? Android:如何在我的活动中启动电话,然后再回到它? - Android: how can I launch phone call in my activity, and then back to it? 我需要从我的android应用中拨打电话号码吗? 从下面看哪一个有效 - I need to call a phone number from my android app? Which one if efficient from the below 如何直接在Android手机上测试我的应用开发? - How can I test my app development directly on an Android phone? 如何通过网络服务器上的命令通过android手机拨打电话? - How to Call a number through a android phone by a command from a web server? 如何在应用程序被杀死时检测 Android 中的来电电话号码? - How to detect incoming call phone number in Android when app is killed?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM