1

I want to add the value like ArrayList<HashMap<String, Object>> to intent, and pass on Activity through broadc. The code like this:

ArrayList<HashMap<String, Object>> listItem = new ArrayList<HashMap<String, Object>>();
intent1.putParcelableArrayListExtra("listItem", listItem);

But it has the error:

The method putParcelableArrayListExtra(String, ArrayList<? extends Parcelable>) in the type Intent is not applicable for the arguments (String, ArrayList<HashMap<String,Object>>)

How to use putParcelableArrayListExtra specific? Through realizing Parcelable interface, can it return the ArrayList < HashMap < String, Object > > Object?

2 Answers 2

3

instead using putParcelableAArrayListExtra, use putExtra method. So change your code to following:

ArrayList<HashMap<String, Object>> listItem = new ArrayList<HashMap<String, Object>>();
intent1.putExtra("listItem", listItem);

and use getSerializableExtra(), to get the arraylist back to next activity.

Sign up to request clarification or add additional context in comments.

Comments

2

Since ArrayList implements Serializable, you don't have to do anything special to feed it to

Just Use Intent.putExtra() to put the values and use getSerializableExtra() to get the arraylist back to next activity.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.