-1

Possible Duplicate:
Intent and Bundle Relation

When we need pass data to another activity I see two typical methods:

  1. Use to method putExtra of Intent object
  2. Create a Bundle Object and use the method putExtras of Intent object

When use each method? Advantages or disadvantages?

Community
  • 1
  • 1
juan
  • 179
  • 2
  • 6
  • 12

3 Answers3

1

Well actually I think both are pretty the same thing, or very similar at least, the big difference is between Parcelable and Bundle,

More infor about Parcelable: Why use parcelable when you can perform the same task using static variables?

Community
  • 1
  • 1
Jachu
  • 405
  • 5
  • 10
1

You can only pass a limited set of values using an Intent, but say if you wanted to pass 10000 values to next Activity, in such a case you can create a single Bundle Object and pass all the values to it and then easily put that Bundle in your Intent.

This question was answered before please refer to Intent and Bundle relation.

Community
  • 1
  • 1
Arif Nadeem
  • 8,524
  • 7
  • 47
  • 78
  • Thanks, question solved. Only one thing, according the link it isn't about number of values; putExtra creates a bundle if not exists. – juan Jan 29 '13 at 17:45
  • If you see the accepted answer it talks about passing multiple values, the basic difference between Bundle and Intent is that you have fine grained control over what elements to pass, you can also remove elements from a Bundle if you wish, also you can make a View parcealable and pass it using a Bundle, Intent gives you options to pass values but it is not as perfect as a Bundle. – Arif Nadeem Jan 29 '13 at 17:54
0

I think this doen't matter... Its just easier to write a Bundle to another function and read it's data, Instead of the whole Intent. But the Intents' function just reads the Bundle

hnzlmnn
  • 393
  • 2
  • 14