I am trying to send "HashMap pointMap" this hash map to a new activity , this is where i send the map , In oncreate method in Main2Activity class
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent myIntent = new Intent(Main2Activity.this, OutActivity.class);
Log.d("Null",dv.getPointMap().toString());
myIntent.putExtra("hashMap", dv.getPointMap());
//pass input int to next activity
Main2Activity.this.startActivity(myIntent);
}
});
And in here dv is a DrawingView class it's extends View and it has method call getPointMap it returns the hashMap
And this how i receive it from next activity
hashMap = (HashMap<Integer , Point>) this.getIntent().getSerializableExtra("hashMap");
before sending i checked whether it has any elements , in the log it shows it has elements but my problem is when the code runs it gives this exception
FATAL EXCEPTION: main Process: com.example.chalaka.myapplication, PID: 22046 java.lang.RuntimeException: Parcel: unable to marshal value com.example.chalaka.myapplication.Point@293492bd at android.os.Parcel.writeValue(Parcel.java:1337) at android.os.Parcel.writeMapInternal(Parcel.java:614) at android.os.Parcel.writeMap(Parcel.java:598) at android.os.Parcel.writeValue(Parcel.java:1255) at android.os.Parcel.writeArrayMapInternal(Parcel.java:638) at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1313) at android.os.Bundle.writeToParcel(Bundle.java:1096) at android.os.Parcel.writeBundle(Parcel.java:663) at android.content.Intent.writeToParcel(Intent.java:7335) at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:2485) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1486) at android.app.Activity.startActivityForResult(Activity.java:3796) at android.app.Activity.startActivityForResult(Activity.java:3744) at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:784) at android.app.Activity.startActivity(Activity.java:4067) at android.app.Activity.startActivity(Activity.java:4035) at com.example.chalaka.myapplication.Main2Activity$1.onClick(Main2Activity.java:93) at android.view.View.performClick(View.java:4808) at android.view.View$PerformClick.run(View.java:19918) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5536) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1397) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1192)
please help me to solve this...