How do I restore my information after using PendingIntent?
<p>My TextMessage activity is passed a name and phone number, and then proceeds to allow the user to type a text message, and send the message on.</p>

<p>My activity does what it is supposed to, however, after sending the message it calls my TextMessage activity again but it doesn't retain the name and phone number.</p>

<p>Is there a way I can do that? I know I can't use "putExtra" for a pendingIntent, so I'm at a loss as to how to do this.</p>

<p>Also, my cancel button crashes in this circumstance because the name and phone number that I received from the previous Intent are now null.</p>

<p>My code:</p>

<pre><code>public class TextMessage extends Activity {

    private Button cancel;
    private EditText message;
    private TextView nameInfo;
    private Button send;

    private String searchName;
    private String searchPhone;

    private SmsManager smsManager;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.message);

        cancel = (Button) findViewById(R.id.cancelmessage);
        send = (Button) findViewById(R.id.sendmessage);
        message = (EditText) findViewById(R.id.messagebodytext);
        nameInfo = (TextView) findViewById(R.id.messageuser);

        searchName = getIntent().getStringExtra("name");
        searchPhone = getIntent().getStringExtra("phonenumber");    

        nameInfo.setText(searchName + ": " + searchPhone);

        smsManager = SmsManager.getDefault();
        //final PendingIntent sentIntent = PendingIntent.getActivity(this, 0, new Intent(this, TextMessage.class), 0);
        Intent intent = new Intent(this, TextMessage.class);
        intent.putExtra("name", searchName);
        intent.putExtra("phonenumber", searchPhone);
        final PendingIntent sentIntent = PendingIntent.getActivity(this, 0, intent, 0);

        send.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v) {
                String messageBody = message.getText().toString();
                if (messageBody.length() &gt; 0) {
                    smsManager.sendTextMessage(searchPhone, null, messageBody, sentIntent, null);
                    finish();
                }
            }
        });

        cancel.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(TextMessage.this, SMS.class);
                intent.putExtra("name", searchName);
                startActivity(intent);
                finish();
            }
        });
    }
}
</code></pre>
