c#使用xamarin编写拨打电话程序
作者:hebedich 时间:2023-09-04 18:09:20
xamarin 可以很方便的编写一个电话拨号程序,下面的代码是调用android系统的拨号功能,拨号前会给出一个提示信息。
callButton是一个用来拨号的按钮,我们使用它的点击事件来进行拨号,拨号前会有一个提示框
callButton.Click += (object sender, EventArgs e) =>
{
// On "Call" button click, try to dial phone number. sharejs.com
var callDialog = new AlertDialog.Builder(this);
callDialog.SetMessage("Call " + translatedNumber + "?");
callDialog.SetNeutralButton("Call", delegate {
// Create intent to dial phone
var callIntent = new Intent(Intent.ActionCall);
callIntent.SetData(Android.Net.Uri.Parse("tel:" + translatedNumber));
StartActivity(callIntent);
});
callDialog.SetNegativeButton("Cancel", delegate { });
// Show the alert dialog to the user and wait for response.
callDialog.Show();
};
以上所述就是本文的全部内容了,希望大家能够喜欢。
标签:c#,xamarin,拨打电话
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
java结合keytool如何实现非对称签名和验证详解
2021-12-21 21:49:35
SpringBoot+docker环境变量配置详解
2022-06-13 07:37:20
![](https://img.aspxhome.com/file/2023/6/84756_0s.png)
解决@JsonInclude(JsonInclude.Include.NON_NULL)不起作用问题
2023-05-26 08:57:45
![](https://img.aspxhome.com/file/2023/0/67470_0s.png)
C++编程中用put输出单个字符和cin输入流的用法
2023-05-28 06:14:49
C语言实现学生信息管理系统
2023-05-24 12:08:50
![](https://img.aspxhome.com/file/2023/8/129548_0s.jpg)
C#抽象类和接口的区别分析
2023-11-09 13:56:21
Java Spring之@Async原理案例详解
2023-05-31 17:13:15
详解C#借助.NET框架中的XmlTextReader类读取XML的方法
2023-01-18 23:31:47
![](https://img.aspxhome.com/file/2023/8/75578_0s.jpg)
JAVAsynchronized原理详解
2023-05-17 12:18:32
![](https://img.aspxhome.com/file/2023/8/80318_0s.png)
Java中SpringSecurity密码错误5次锁定用户的实现方法
2021-07-10 10:38:17
WPF实现调用本机摄像头的示例代码
2023-03-15 15:40:24
![](https://img.aspxhome.com/file/2023/6/68076_0s.png)
浅析C#静态类,静态构造函数,静态变量
2022-04-10 03:33:14
Android禁止横屏竖屏切换的有效方法
2023-05-05 10:56:16
Android性能优化大图治理示例详解
2023-12-13 00:18:01
![](https://img.aspxhome.com/file/2023/4/100604_0s.png)
Java基础之并发相关知识总结
2022-04-24 13:59:05
![](https://img.aspxhome.com/file/2023/4/85414_0s.png)
深入了解Java核心类库--Math类
2023-08-19 01:06:21
java实现捕鱼达人游戏
2023-11-23 21:28:59
![](https://img.aspxhome.com/file/2023/6/70926_0s.jpg)
C#与C++之间类型的对应知识点总结
2023-09-07 21:02:56
SpringBoot整合Dozer映射框架流程详解
2023-03-08 02:23:48
![](https://img.aspxhome.com/file/2023/7/132127_0s.png)
Springboot与Maven多环境配置的解决方案
2023-11-29 08:53:58
![](https://img.aspxhome.com/file/2023/9/60679_0s.png)