Is their a way to put a POJO inside the intent.putExtra?
I have looked into the API's and it only seems to support of type string, int, double, boolean etc but not a actual POJO/regular java object.
You can use a POJO as long as it implements Serializable
or Parcelable
. Take a look at intent.putExtra(String, Serializable)
or intent.putExtra(String, Parcelable)
.
You can pass them
intent.putExtra(String, Serializable)
intent.putExtra(String, Parcelable)
Also don't forget how to get them
obj = intent.getParcelableExtra(String)
obj = intent.getSerializableExtra(String)
Better implement Parceable because it's CPU faster.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.