簡體   English   中英

如何通過我的android應用撥打電話號碼?

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

我制作了一個簡單的應用程序,該應用程序在列表視圖中包含緊急電話號碼,而我想要做的是,當我單擊列表視圖上的聯系人時,我可以撥打電話號碼

這是一個有關如何撥打號碼123456789的示例。

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

只需將其放在listView的OnItemClickListener()方法中即可。 希望對您有所幫助。

在按鈕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);

在清單設置權限CALL_PHONE中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM