Home > Software design >  direct phone call from recycler view,at kotlin
direct phone call from recycler view,at kotlin

Time:12-22

Currently I am a beginner, I am using firestore, from where all the data are showing in RecyclerView like name,address,phone number etc. Now, I want to do phone call by using the "button" besides "phone number ". Can anyone help me?! Kotlin

CodePudding user response:

You can do phone calls through Intent here is the demo code

    val phoneIntent = Intent(Intent.ACTION_CALL)
    phoneIntent.data = Uri.parse("tel:1234567890")
    startActivity(phoneIntent)   

add relevant permission to your manifest

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

CodePudding user response:

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

I think you are looking for something like this:

Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"   "Your Phone_number"));
startActivity(intent);
  • Related