Is there a way to check and see if an Activity exists on your device? If I have a youtube video link I want to specify it open in the YouTube PlayerActivity. However, I don\
I ended up doing:
Intent intent = new Intent();
intent.setClassName( "com.google.android.gsf", "com.google.android.gsf.login.AccountIntroActivity" );
if(getContext().getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null) {
getContext().startActivity( intent );
} else {
getContext().startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT));
}
This ensures that the google-specific Add Account intent exists, and if not, falls back on the general more general ACTION_ADD_ACCOUNTS.