How to open number dialer pad programmatically in android?

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

For this we don't need to add any permission in AndroidManifest.xml


You can use this code if you want to open the dialer programmatically without any number inserted:

Java

Intent intent = new Intent(Intent.ACTION_DIAL);
startActivity(intent);

Kotlin

val intent = Intent(Intent.ACTION_DIAL)
startActivity(intent)

If you need to open the dialer with the number already digited you can use this code:

Java

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

Kotlin

val intent = Intent(Intent.ACTION_DIAL)
intent.data = Uri.parse("tel:123 456789")
startActivity(intent)