Roy Hinkley
Roy Hinkley

Reputation: 10651

Forward bundle from one intent to another

Is there a way to pass an intent bundle from one intent to another without having to extract the bundle and handle each extra individually?

Example:

intent2.setExtras(intent2.getExtras());

Upvotes: 1

Views: 976

Answers (2)

Serge Bollaerts
Serge Bollaerts

Reputation: 324

There is a dedicated function

Intent.putExtras(Bundle extras)

Hope this helps Serge

Upvotes: 2

Alex Fu
Alex Fu

Reputation: 5527

Why not? Given that there exist 3 Activities: ActivityA, ActivityB, and ActivityC...

Activity A

Intent intentA = new Intent(this,ActivityB.class);
intentA.putExtras(new Bundle());

Activity B

Intent intentB = new Intent(this,ActivityC.class);
intentB.putExtras(getIntent());

Activity C

Intent intentFromA = getIntent();
// Consume and process the Bundle here.

Upvotes: 2

Related Questions