What Android means "all possible data types" and how can I use this data?

Given the architecture of Android and considering the operational design of Android with things like intentions, attitudes, activity, content provider, etc., can someone explain to me which “thing” is comparable or complex? The explanation written on the Android website sounds a little too weak for me, I mean reading this "A special container with a security type called Bundle is available for cards with a key / value of dissimilar values." I don’t know anything more about the Bundles, for me they can be XML files, hash maps and all other key / value maps.

What is a Parcelable or Bundle and what is their view and what do they do?

Thank.

+5
source share
3 answers

Parcelableand Bundle- these are packets of information that you want to send with intent!

Bundle: If you want to launch a new one activity, you can send Bundleinformation to the one activitycreated along with new Intent:

// Bundle b is sent with new intent i
Bundle b = new Bundle();
b.putString(key, value);
b.putInt(key, value);
Intent i = new Intent(...);
i.putExtras(b);
startActivity(i);
// In the activity which started from the intent i, you can get the bundle b
this.getIntent().getExtras();

Parcelableis interface, if you want to pass object(your own class) using Bundleor using intent, you must implement this interface:

class Example implements Parcelable{
      // some information here
}
// You can send with intent or bundle:
b.putParcelable(key, value);
i.putExtra(name, value);

Read more about google android here: Bundle Parcelable

+10
source

Android has defined a new lightweight IPC (Inter Process Communication) data structure called Parcel, where you can smooth out your objects in a byte stream, just like the concept of J2SDKs serialization.

Android- (IPC). Android "" Linux, , Parcels Android , / .

Parcels , . , Android , "Activities", . , , Parcelable. Android Parcelable, Intent, .

Bundle - Android. , , . , , .

+4

A Bundle implements Parcelable . A package instance is used to store name / value pairs, where name is a string and value is a class that implements Parcelable. A class that implements Parcelable can be converted to Parcel , which can be serialized through IBinder , which is used for IPC.

The most common use for this is to pass values ​​between actions and services (Intent extras)

+3
source

All Articles