How can I call a number from button press in Android?

前端 未结 7 1329
轻奢々
轻奢々 2021-01-03 13:44

I\'m very much a beginner at this and I\'m struggling to get this to work.

When button is pressed, I simply want the dialer to open with the specified number automa

7条回答
  •  滥情空心
    2021-01-03 14:03

    String number = "12345678";
        Intent intent = new Intent(Intent.ACTION_CALL);
        intent.setData(Uri.parse("tel:" +number));
        startActivity(intent);
    

    You need to add this Permission to your manifest.

    
    

提交回复
热议问题