I launch skype with this code.

Intent skype_intent = new Intent("android.intent.action.VIEW"); skype_intent.setClassName("com.skype.raider", "com.skype.raider.Main"); skype_intent.setData(Uri.parse("skype: skype_name")); startActivity(skype_intent); 

It's okay But if there is no skype on the phone, the application crashes. How can I call Skype another way, so that it does not crash the application or make a check for skype on the phone. If you have run the code, if not output "You do not have skype"?

  • 2
    and what prevents to handle an exception (try catch) and display "you do not have skype" when it is more beautiful. How exactly does crash happen? - alexoander
  • FATAL EXCEPTION: main android.content.ActivityNotFoundException: unable to find activity activity {com.skype.raider / com.skype.raider.Main}; have your AndroidManifest.xml? - Skivs

1 answer 1

I think in explanation this code does not need:

 private boolean isAppInstalled(String packageName) { PackageManager pm = getPackageManager(); boolean installed = false; try { pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES); installed = true; } catch (PackageManager.NameNotFoundException e) { installed = false; } return installed; }