I don't need to call the phone number, I just need the dialer to open with the phone number already displayed. What Intent should I use to achieve this?
I don't need to call the phone number, I just need the dialer to open with the phone number already displayed. What Intent should I use to achieve this?
Okay, it is going to be extremely late answer to this question. But here is just one sample if you want to do it in Kotlin.
val intent = Intent(Intent.ACTION_DIAL)
intent.data = Uri.parse("tel:<number>")
startActivity(intent)
Thought it might help someone.
<TextView
android:id="@+id/phoneNumber"
android:autoLink="phone"
android:linksClickable="true"
android:text="+91 22 2222 2222"
/>
This is how you can open EditText label assigned number on dialer directly.
You can call Intent following this:
String number = "0123456789";
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:" + number));
startActivity(intent);
A helper function for someone using kotlin:
fun openDialPad(context: Context, phoneNum: String) {
val intent = Intent(Intent.ACTION_DIAL)
intent.setData(Uri.parse("tel:$phoneNum"))
context.startActivity(intent)
}