title: How manage "No application can perform this action" (AKA ActivityNotFoundException)
body: <p>So this is my code</p>
  
  <pre><code>    public void onClick() {
                  try {
                       startActivity(Utils.openFile(f.getPath(),myExt));
                  }
                  catch(ActivityNotFoundException activityNotFoundException) {
                      Toast.makeText(mContext, "Nessuna App trovata", Toast.LENGTH_LONG).show();
                      Intent intent = new Intent(Intent.ACTION_VIEW);
                      intent.setData(Uri.parse("market://search?q="+myExt+"&amp;c=apps"));
                      startActivity(intent);
                  }   
  </code></pre>
  
  <p>Where my Utils.openfile() is</p>
  
  <pre><code>public static Intent openFile(String u,String b) {
      File file = new File(u);
      Intent target = new Intent(Intent.ACTION_VIEW);
      target.setDataAndType(Uri.fromFile(file),"application/" + b);
      target.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
      Intent intent = Intent.createChooser(target, "Apri File");
      return intent;       
  }
  </code></pre>
  
  <p>Now as you see I'd like to manage that if can't found any app that can opens my file (pdf,mobi or epub) I'd like to start an intent to link to android market and search any apps..</p>
  
  <p>But, I don't know why, my code never runs into exception but just show a dialog that say "No application can perform this action".. How could I manage and achieve my target?</p>