2

In onActivityResult() why do we have a intent as parameter ?
If it was the case of sending data from one activity to another ,can't data be sent via bundle ?

Help me !!

Pavan
  • 519
  • 1
  • 6
  • 16

4 Answers4

1

The Intent is for receiving data back in the onActivityResult(int, int, Intent) method of your calling Activity. And, yes, a Bundle can be a part of this Intent.

Submersed
  • 8,810
  • 2
  • 30
  • 38
  • my question was why is intent sent as a parameter and why cant bundle be sent in the place of intent in the parameter list to send data? – Pavan Jan 30 '14 at 04:35
1

The document says,

An Intent provides a facility for performing late runtime binding between the code in different applications. Its most significant use is in the launching of activities, where it can be thought of as the glue between activities. It is basically a passive data structure holding an abstract description of an action to be performed.

Intent is used in Activity's transition.
For example, Intent is used when calling Activity_B from Activity_A.
Also, it is used when returning from B to A. That's all.

Zhenghong Wang
  • 2,117
  • 17
  • 19
1

Think of an Intent as Message that you can send all over the android System between the android Components (Activity , BroadcastReceiver , Service , ContentProvider ) .

and this Intent (Message) need to have some content inside , and think of the Bundle as the content of your Message that you are sending to the other component .

Hope that Helps

0

whenever we start any activity for result by calling startActivityForResult() from current activity, it is must that started activity will return back with some response, and this response will warped in intent object.

Yes you can do this, but it will being complex when you application will getting large means you are heavily using Bundle,

one drawback is more using Bundle it will having Key value pairs so its possible accidentally change you value by some other activity.

Lavekush Agrawal
  • 6,040
  • 7
  • 52
  • 85