title: how to pass data from notification to activity in android
body: <p>i need to create two statusbar Notifications.when i click first notification icon., i've to disaply some data(ex.activity1).,if i click second notification icon.,i've to display another data(Ex.activity2).i've created well.But i couldnt able to display data.</p>
  
  <p>My code:</p>
  
  <pre><code>package com.collabera.labs.sai;
  
  import java.util.ArrayList;
  
  import android.R.string;
  import android.app.Activity;
  import android.app.Notification;
  import android.app.NotificationManager;
  import android.app.PendingIntent;
  import android.content.Context;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  
  public class SimpleNotification extends Activity {
  
      private NotificationManager mNotificationManager;
      private int SIMPLE_NOTFICATION_ID_A = 0;
      private int SIMPLE_NOTFICATION_ID_B = 1;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
  
          Button start = (Button) findViewById(R.id.notifyButton);        
          //Button cancel = (Button)findViewById(R.id.cancelButton);
  
          start.setOnClickListener(new OnClickListener() {
              public void onClick(View v) {
                  // display A
                  displayNotification("Extra for A", "This is A", "Some text for activity A", MyActivityA.class, SIMPLE_NOTFICATION_ID_A);
                  // display B
                  displayNotification("Extra for B", "This is B", "Some text for activity B", MyActivityB.class, SIMPLE_NOTFICATION_ID_B);
              }
          });
      }
  
      private void displayNotification(String extra, String contentTitle, String contentText, Class&lt;?&gt; cls, int id) {     
          Notification notifyDetails = new Notification(R.drawable.icon, "New Alert!", System.currentTimeMillis());
          Intent intent = new Intent(this, cls);
          Bundle b=new Bundle();
          b.putString("extra", extra);
          intent.putExtras(b);
          PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), id, intent, PendingIntent.FLAG_ONE_SHOT);
          notifyDetails.setLatestEventInfo(getApplicationContext(), contentTitle, contentText, contentIntent);
          mNotificationManager.notify(id, notifyDetails);
  
  }
  
  }
  </code></pre>
  
  <p>On MyActivityA:</p>
  
  <pre><code>TextView tv;
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.sub);
      tv=(TextView)findViewById(R.id.tv);
      Bundle b = getIntent().getExtras();
  
      String value = b.getString("extra");
      tv.setText(value);
  </code></pre>
  
  <p>Whats error on this..It didnt displayed the text..</p>