Skip to content Skip to sidebar Skip to footer

Send Message Through Intent Filter

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

Solution 1:

you use the putExtras(Bundle) method of the Intent

Bundleextras=newBundle();
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"));
  }
}

Post a Comment for "Send Message Through Intent Filter"