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 in Android by Edureka
• 12,390 points
35 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 by Edureka
• 10,880 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 in Android by Edureka
• 12,390 points
42 views
0 votes
0 answers

"unable to locate adb" using Android Studio

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

Sep 21 in Android by Edureka
• 12,390 points
103 views
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 in Android by Edureka
• 12,390 points
61 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
426 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,100 points
343 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,350 points
5,887 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 in Android by Edureka
• 10,880 points
49 views
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