I am new to android and I use intents to transfer data from one Activity to another. I just wanted to know whether the object reference or object copy is sending to the second Activity.
Using putExtra() and getExtras() in android For example an Activity can send an Intents to the Android system which starts another Activity . putExtra() adds extended data to the intent. It has two parameters, first one specifies the name which of the extra data,and the second parameter is the data itself.
PutExtra() - we can store any primitive data type directly with (key,value) pair. And PutExtras() - hold object of Bundle class object . Bundle class provide us method of specific primitive data type methods to store data in it.
setType(String mimeType) input param is represent the MIME type data that u want to get in return from firing intent(here myIntent instance). by using one of following MIME type you can force user to pick option which you desire. Please take a Note here, All MIME types in android are in lowercase.
An Intent object carries information that the Android system uses to determine which component to start (such as the exact component name or component category that should receive the intent), plus information that the recipient component uses in order to properly perform the action (such as the action to take and the ...
Intent.putExtra sends a copy of the object it is not the same reference when you get the extra from the intent you make the new reference there
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With