title: Making a shortcut to a class (not the MainActivity) on the Android Homescreen
body: <p>I've been looking ALL DAY to no avail..I know there are several questions on this but I haven't been able to find one that works properly for me.</p>
  
  <p>Basically, I have an activity (MainActivity), with a function to add a shortcut to the home screen.  When I click the shortcut, I want it to open a different activity (NewActivity).  The hold up here seems to be that it doesn't work right when I try to launch a different activity than the one from which the shortcut was made.</p>
  
  <p>The shortcut is successfully made, but when I click it I get an "App isn't installed" toast message from the Android system.</p>
  
  <p>Here's the code for adding the shortcut:</p>
  
  <pre><code>                Intent shortcutIntent = new Intent();
                  shortcutIntent.setClassName("com.enceladus.myApp", "com.enceladus.myApp.NewActivity");
                  shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                  shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                  Intent addIntent = new Intent();
                  addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
                  addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Calculator");
                  addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(MainActivity.this, R.drawable.calc));
                  addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
                  MainActivity.this.sendBroadcast(addIntent);
  </code></pre>
  
  <p>EDIT: Here's my manifest:</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.enceladus.myApp"
  android:versionCode="1"
  android:versionName="1.0" &gt;
  
  &lt;uses-sdk
      android:minSdkVersion="9"
      android:targetSdkVersion="15" /&gt;
  &lt;uses-permission android:name="android.permission.CAMERA"/&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
  &lt;uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" /&gt;
  &lt;uses-feature android:name="android.hardware.camera" /&gt;
  &lt;uses-feature android:name="android.hardware.camera.autofocus" /&gt;
  
  &lt;application
      android:icon="@drawable/ic_launcher"
      android:label="@string/app_name"
      android:theme="@style/AppTheme" &gt;
      &lt;activity
          android:name=".MainActivity"
          android:label="@string/title_activity_main" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;activity android:name="com.enceladus.myApp.NewActivity"
          android:label=""
          android:screenOrientation="portrait"
          android:theme="@android:style/Theme.Translucent.NoTitleBar"
          android:launchMode="singleInstance"
          /&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p>NewActivity.class functions perfectly (I know because I've debugged it a lot), so that's not the problem.</p>