Solved With This: how to open android application if installed and go to android market if not install
I need to check if an app is installed before start it, and if not prompt the user a toast message like "The app is not installed, please press on the Download from market" or automatically link to market.
My app (main) is a webview with 2 buttons:
- Download the app from market (works correctly, html is < a href="inkstudio://market" >) 
- Launch the app (html is < a href="inkstudio://lancia" >) 
If I press the button #1 (download) I can download correctly the app from the PlayStore, and if I press the button #2 the downloaded app start correctly.
But if I press the button#2 when the app is not installed, I get a crash. How can i prevent this?
My code is:
if(url.equals("inkstudio://market")){
    Intent lancia = new Intent(Intent.ACTION_VIEW);
    lancia.setData(Uri.parse("market://details?id=com.aurasma.aurasma"));
    startActivity(lancia);
}
if(url.equals("inkstudio://lancia")){
    Intent lancia = new Intent(Intent.ACTION_VIEW);
    lancia.setData(Uri.parse("aurasma://?YXVyYXNtY"));
    startActivity(lancia);
}
 
     
    