android studio calling button

Here is the working code:

protected void onCreate(Bundle savedInstanceState) {
    findViewById( View.OnClickListener() {
        public void onClick(View v) {

private void dialContactPhone(final String phoneNumber) {
    startActivity(new Intent(Intent.ACTION_DIAL, Uri.fromParts("tel", phoneNumber, null)));

You need Action_Dial,

use below code it will open Dealer with number specified.

Intent intent = new Intent(Intent.ACTION_DIAL);

The tel: prefix is required, otherwhise the following exception will be thrown: java.lang.IllegalStateException: Could not execute method of the activity.

Action_Dial doesn’t require any permission.

If you want to initiate the call directly without user’s interaction, you can use action Intent.ACTION_CALL. In this case, you must add the following permission in your AndroidManifest.xml:

<uses-permission android:name="android.permission.CALL_PHONE" />

I need to enter code above the application list on the manifest:

<uses-permission android:name="android.permission.CALL_PHONE"/>

Leave a Comment