Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: what is the difference between Bundle Vs java.util collections like HashMap

Tags:

java

android

What is the difference between Bundle Vs java.util collections like HashMap?

like image 621
Venkat Papana Avatar asked Jun 04 '11 12:06

Venkat Papana


1 Answers

One difference I can see easily is that a Bundle allows you to put int, boolean, etc., into it while a HashMap seems to require you to convert them to/from objects.

A more important difference is that with a Bundle, every object it contains is parcelable. This allows Bundles to be used as service parameters and to be attached to intents / passed into activities.

like image 82
mah Avatar answered Sep 30 '22 02:09

mah