c#使用xamarin編寫撥打電話程序
更新時間:2015年05月18日 09:18:04 投稿:hebedich
Xamarin是一個行動App開發(fā)平臺,提供跨平臺開發(fā)能力,開發(fā)人員透過Xamarin開發(fā)工具與程序語言,即可開發(fā)出iOS、Android 與Windows 等平臺的原生(Native) App 應用程序,不須個別使用各平臺的開發(fā)工具與程序語言,
xamarin 可以很方便的編寫一個電話撥號程序,下面的代碼是調用android系統(tǒng)的撥號功能,撥號前會給出一個提示信息。
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#實現(xiàn)創(chuàng)建標簽PDF文件的示例代碼
標簽PDF文件包含描述文檔結構和各種文檔元素順序的元數據,是一種包含后端提供的可訪問標記,管理閱讀順序和文檔內容表示的邏輯結構的PDF文件。本文將用C#實現(xiàn)創(chuàng)建標簽PDF文件,需要的可以參考一下2022-08-08結合Visual C#開發(fā)環(huán)境講解C#中事件的訂閱和取消訂閱
這篇文章主要介紹了C#中事件的訂閱和取消訂閱,結合Visual C#開發(fā)環(huán)境來進行講解,Visual C#被集成在微軟的IDE程序Visual Studio中,需要的朋友可以參考下2016-01-01