Reputation: 10984
how to send a message from one activity to another using intent and intent filters?
Upvotes: 2
Views: 1799
Reputation: 6900
you use the putExtras(Bundle) method of the Intent
Bundle extras = new Bundle();
extras.putString("my.unique.extras.key", "this is my message");
myIntent.putExtras(extras);
Then in the Intent you retrieve the extras
Bundle extras = this.getIntent().getExtras();
if ( extras != null ) {
if ( extras.containsKey("my.unique.extras.key") ) {
this.setTitle(extras.getString("my.unique.extras.key"));
}
}
Upvotes: 6