android studio calling button

0 votes

I'm attempting to create a button that, when clicked, will dial a phone number. Here is my Java code:

public void CampusSafClick(View view){
    Intent callIntent =new Intent(Intent.ACTION_CALL);
    callIntent.setData(Uri.parse("tel:6038994210"));
    startActivity(callIntent);
}

The problem is not with making onclick buttons; I know how to do that.

This manifest code is mine:

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

The message "Unfortunately, your app has stopped working" keeps appearing.

Nov 10, 2022 in Android by Edureka
• 13,620 points
470 views

1 answer to this question.

0 votes

You may utilize the upcoming code.

intent =new Intent(Intent.ACTION_DIAL);
            intent.setData(Uri.parse("tel:+251999999999"));
            startActivity(intent);

and include in the manifest file

<uses-permission android:name="android.permission.CALL_PHONE"/>
answered Nov 10, 2022 by Edureka
• 12,690 points

Related Questions In Android

0 votes
0 answers

Android Studio: Where is the Compiler Error Output Window?

When I "Run" my project in Android ...READ MORE

Sep 21, 2022 in Android by Edureka
• 13,620 points
284 views
0 votes
0 answers

"unable to locate adb" using Android Studio

I've been attempting to test my software ...READ MORE

Sep 21, 2022 in Android by Edureka
• 13,620 points
369 views
0 votes
0 answers
0 votes
0 answers

Android Studio AVD - Emulator: Process finished with exit code 1

I'm having trouble starting my android emulator. ...READ MORE

Sep 21, 2022 in Android by Edureka
• 13,620 points
570 views
0 votes
1 answer

How can we get the current location in Android?

First you need to define a LocationListener to handle ...READ MORE

answered Sep 25, 2018 in Java by Parth
• 4,630 points
748 views
0 votes
1 answer

Can't find class CognitoUserPoolsSignInProvider: Issue with Sign In integration

CognitoUserPoolsSignInProvider is ditributed as part of aws-android-sdk-auth-userpools library. Please import ...READ MORE

answered Sep 28, 2018 in AWS by Priyaj
• 58,090 points
679 views
0 votes
1 answer

How to Read/Write String from a File in Android

Writing a File in android: private void writeToFile(String ...READ MORE

answered Oct 3, 2018 in Java by sharth
• 3,370 points
6,975 views
0 votes
1 answer

Open Contact information in Contact List using Phone Number of Contact Android Studio

You must first obtain the contact's CONTACT ...READ MORE

answered Nov 7, 2022 in Android by Edureka
• 12,690 points
647 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP