I have the following code:
List<ValueActivity> list = new ArrayList<ValueActivity>();
list = setList();
Intent intent = new Intent(NOTIFICATION);
Bundle bundle = new Bundle();
bundle.put ????("list", list);
intent.putExtra("bundle", bundle);
sendBroadcast(intent);
How to write line 5 and how getExtra in destination intent
You will need to have
ValueActivity
implementParcelable
interface and you will need to implementwriteToParcel()
theCREATOR
and a suitable constructor that takes aParcel
as argument. See the documentation ofParcelable
interface.To put the list into the
Bundle
, use:To get the list out of the
Bundle
in the target activity, use:try to use :