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# 对PDF文档加密、解密(基于Spire.Cloud.SDK for .NET)
Unity通用泛型单例设计模式(普通型和继承自MonoBehaviour)
网友评论