Shishir.bobby
Shishir.bobby

Reputation: 10984

Send message through intent filter

how to send a message from one activity to another using intent and intent filters?

Upvotes: 2

Views: 1799

Answers (1)

Ryan Conrad
Ryan Conrad

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

Related Questions