title: How to start activity when user clicks a notification?
body: <p>I am attempting to convert some code I found in a tutorial for my own use. Originally, the code launched the system contacts list when the user would click a notification generated by my app. I am trying to start an <code>Activity</code> of my own instead of launching the contact list, but it's not working. More specifically, nothing happens. There is no error, and my <code>Activity</code> doesn't load either. The notification window disappears after clicking, and the original <code>Activity</code> is still visible. </p>
  
  <p>Here is my code:</p>
  
  <pre><code>public class MyBroadcastReceiver extends BroadcastReceiver {
      private NotificationManager mNotificationManager;
      private int SIMPLE_NOTFICATION_ID;
  
      public void onReceive(Context context, Intent intent){
          Bundle extras = intent.getExtras();
  
          String deal = (String) extras.get("Deal");
          String title = "Deal found at " + (String) extras.get("LocationName");
  
          mNotificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
          Notification notifyDetails = new Notification(R.drawable.icon, title,System.currentTimeMillis());
  
          Class ourClass;
          try {
              ourClass = Class.forName("com.kjdv.gpsVegas.ViewTarget");
              Intent startMyActivity = new Intent(context, ourClass);
  
              PendingIntent myIntent = PendingIntent.getActivity(context, 0,startMyActivity, 0);
              notifyDetails.setLatestEventInfo(context, title, deal, myIntent);
              notifyDetails.flags |= Notification.FLAG_AUTO_CANCEL;
              notifyDetails.flags |= Notification.DEFAULT_SOUND;
              mNotificationManager.notify(SIMPLE_NOTFICATION_ID, notifyDetails);
          }
          catch (ClassNotFoundException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>This is my entry in the <code>AndroidManifext.xml</code> file...</p>
  
  <pre><code>  &lt;activity android:name=".ViewTarget" android:label="@string/app_name" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.kjdv.gpsVegas.ViewTarget" /&gt;
              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
          &lt;/intent-filter&gt;
     &lt;/activity&gt;
  </code></pre>
  
  <p>And this is my <code>Activity</code> that I want to launch...</p>
  
  <pre><code>public class ViewTarget extends ListActivity {
      public ListAdapter getListAdapter() {
          return super.getListAdapter();
      }
  
      public ListView getListView() {
          return super.getListView();
      }
  
      public void setListAdapter(ListAdapter adapter) {
          super.setListAdapter(adapter);
      }
  
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.locations);
          Log.v("db", "Inside ViewTarget");
      }
  }
  </code></pre>