[英]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.