2

Ever since I started working with bundles, all I know is that a bundle is a way to store data within it so that it can be passed to another activity and the other activity can access the data being pass/stored in the bundle. However, I was confused when I saw that you can do ActivityOptions.makeCustomAnimation().toBundle() and then pass that into the startActivity(intent,bundle) to provide additional information about how the activity should be started. When that activity is started, the animation is run.

So if my theory that the Bundle is just data is correct, then shouldn't I need to handle that data, and tell Android to run that data as an animation? This seems not to be the case; when I start an activity with the bundle generated from ActivityOptions.makeCustomAnimation().toBundle(), the animation runs immediately. This makes me very confused, so:

  1. I would like to know what exactly happens with this bundle object.

  2. I want to know how Android determines that this is the start animation, and that it should be run without needing the user to go into the second activity and use methods such as startAnimation() in order to launch the new animation.

I have taken a look at the suggested duplicate What is a "bundle" in an Android application and it doesn't answer my question because it only explains what a bundle is used for and how is it used. It does not explain how bundles are handled when starting a new activity, therefore it does not provide an answer to my specific questions above.

Community
  • 1
  • 1
Wowzer
  • 1,103
  • 2
  • 12
  • 26

0 Answers0