I'm trying to open another app from my app . if that app is not installed my code will open the market place. i use this code
PackageManager pm = getPackageManager();
try
{
Intent intent = pm.getLaunchIntentForPackage(package_name);
startActivity(intent);
}
catch(android.content.ActivityNotFoundException anfe)
{
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + package_name)));
}
if market
is not presence in the device i should open
http://play.google.com/store/apps/details?id=<package_name>
this url.
how to catch the exception at second time? i have already used catch in my code; can i use one more?
try{
Intent intent = pm.getLaunchIntentForPackage(package_name);
startActivity(intent);
}
catch(Exception anfe)
{
try{
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + package_name)));
}
catch(Exception a){
{
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("https://play.google.com/store/apps/details?id=" + package_name)));
}
}