简体   繁体   中英

direct phone call from recycler view,at kotlin

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

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" /> 

<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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM