i have a problem with updating my textview. i am making a c2dm app. the messages i send are being recieved by the device (as i have put the message to display in the notifcation bar. also i have many logs that state a message has been received). however once i click on a message within the notification area to open up my view it only shows my 1 message. e.g i send a message, then i want to send another message only the first message shows.
i have found out i may need an onNewIntent
however i'm not sure if i have gone around it in the correct manner.
public class MessageReceivedActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_result);
Bundle extras = getIntent().getExtras();
if (extras != null) {
String message = extras.getString("payload");
if (message != null && message.length() > 0) {
TextView view = (TextView) findViewById(R.id.result);
view.setText(message);
}
}
super.onCreate(savedInstanceState);
}
@Override
protected void onNewIntent(Intent intent) {
setContentView(R.layout.activity_result);
Bundle extras = getIntent().getExtras();
if (extras != null) {
String message = extras.getString("payload");
if (message != null && message.length() > 0) {
TextView view = (TextView) findViewById(R.id.result);
setIntent(intent);
view.setText(message);
}
}
// setIntent(intent);
}
}
my layout is activity_result which contains only 1 textview my text view is called result and payload is the message i send from my server
any help would be appreciated