To check if intent is actually supported, use the following code:
PackageManager pm = getPackageManager(); Intent installIntent = new Intent(); installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA); ResolveInfo resolveInfo = pm.resolveActivity( installIntent, PackageManager.MATCH_DEFAULT_ONLY ); if( resolveInfo == null ) { // Not able to find the activity which should be started for this intent } else { startActivity( installIntent ); }
If it cannot find the action using resolveActivity (), then this action requires other parameters that are not provided. In this case, you should get the class name using queryIntentActivities () and set the component name / class of intent.
source share