Call intent in Android

前端 未结 7 1222
生来不讨喜
生来不讨喜 2020-12-10 06:16

How can I make call by pressing button? I get my number as a string from EditText. Here is my sample code:

String phone = editPhone         


        
7条回答
  •  有刺的猬
    2020-12-10 06:43

    Intent callIntent = new Intent(Intent.ACTION_CALL);
    callIntent.setData(Uri.parse(phone));
    startActivity(callIntent);
    

    above is the only method you use for calling a phone number in android, when you click on the call button a 'dilerpad' activty is started with perpopulated phone number, and the call will go if you press the call button on the dialer pad.

提交回复
热议问题