No Activity Found To Handle Intent { Act=android.intent.action.dial }
I want to open my phone dialer .But it shows error. I have declared permissions for CALL_PHONE on Android Manifest and also declared class in Android Manifest. case R.id.action_cal
Solution 1:
You don't need any permissions for ACTION_DIAL
Intent. So remove CALL_PHONE
permission from AndroidManifest.xml
.
You have not pass any number to fire dial Intent.
Use tel:
followed by the phone number as the value passed to Uri.parse():
Try this code.
Stringnumber = "1234567890";
Urinumber = Uri.parse("tel:" + number);
Intent dial = newIntent(Intent.ACTION_DIAL);
dial.setData(number);
startActivity(dial);
EDIT:
You can first check whether telephony is supported on device
privatebooleanisTelephonyEnabled(){
TelephonyManagertm= (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
return tm != null && tm.getSimState()==TelephonyManager.SIM_STATE_READY
}
I hope it helps!
Solution 2:
Use Uri
to parse number..
Intentcall=newIntent(Intent.ACTION_DIAL);
call.setData(Uri.parse("tel:"+phone)); //String phone
startActivity(call);
Solution 3:
- Use try/catch.
- Use Uri to parse number.
Don't need any permissions for ACTION_DIAL intent.
try{ Intentcall_intent=newIntent(Intent.ACTION_DIAL); call_intent.setData(Uri.parse("tel:"+phone_number)); startActivity(call_intent); }catch(Exception e){ }
Post a Comment for "No Activity Found To Handle Intent { Act=android.intent.action.dial }"