title: Android Intent To Open Application Not Working
body: <p>I am trying to open the Google Voice Search Application</p>
  
  <pre><code>    Intent i;
      PackageManager manager = getPackageManager();
      try {
          i = manager.getLaunchIntentForPackage("com.google.android.voicesearch");
          if (i == null)
              throw new PackageManager.NameNotFoundException();
          i.addCategory(Intent.CATEGORY_LAUNCHER);
          startActivity(i);
      } catch (PackageManager.NameNotFoundException e) {
      }
  </code></pre>
  
  <p>This does not launch the voice search application,
  however if I use com.google.android.apps.maps as the package name then the Google Maps app is opened.</p>
  
  <p><strong>I don't understand why Voice Search is not opening, even though the package name is correct.</strong></p>
  
  <p><strong>Solution</strong></p>
  
  <pre><code>Intent intent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
  startActivity(intent);
  </code></pre>
  
  <p>Please see
  <a href="https://stackoverflow.com/questions/9074313/launch-preinstalled-app-from-activity-google-voice-search-android">Launch Preinstalled App from activity (Google Voice Search) Android</a> for more information on the solution.</p>
  
  <p>Thank you.</p>