0

I'm trying to send HashMap to start new activity with startActivity(intent).

I followed the answer from this link: How to send hashmap value to another activity using an intent

But I still get error

Of course, i tried to send String

intent.putExtra("test","some String");
startActivity(intent);

And it worked

My code:

HashMap<String,Diner> dinersOrdersHasMap = new HashMap<String,Diner>();
FillHashMap(); // Fill the HashMap with data

Intent intent = new Intent(this, BillForm.class);
intent.putExtra("dinersOrderHashMap",dinersOrdersHasMap);
startActivity(intent);

The exception:

   "Could not execute method for android:onClick", e);

    e.detailMessage = "Parcelable encountered IOException writing serializable 
    object (name = com.example.myfirstapp.Diner)

When i call startActivity(intent);

Gal Barak
  • 65
  • 5

1 Answers1

1

is your Diner class Serializable or Parcelable ?

Could you post here your Diner class ?

SebastienRieu
  • 1,443
  • 2
  • 10
  • 20