bundle get Serializable / Activity crashes

502 views Asked by At

I have a problem when I try to start my SecondActivity in my app.. I retrieve a list of objects from my FirstActivity but the secondactivity keeps crashing..

FirstActivity:

Intent mainIntent = new Intent(ScanFiltersActivity.this, ScanRegionsActivity.class);
              Bundle bundle = new Bundle();
              bundle.putSerializable("regionlist", beaconRegions);
              mainIntent.putExtras(bundle);
              startActivity(mainIntent);

SecondActivity:

 Bundle secondBundle = getIntent().getExtras();
    regionsList = (ArrayList<IBeaconRegion>) secondBundle.getSerializable("regionlist");

Any solutions? Thanks in advance!

1

There are 1 answers

0
Naveen T P On

May be you need to implement Serializable in your POJO class like this

public class IBeaconRegion implements Serializable{
     // your variables , getter setters
}

Hope this helps.