0

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!

diamond
  • 13
  • 1
  • 6
  • 3
    Add the crash report in question . – ADM Mar 24 '18 at 17:37
  • implement a serializable interface in your `IBeaconRegion` class – akhilesh0707 Mar 24 '18 at 17:59
  • Unable to start activity ComponentInfo{com.kontakt.sample/com.kontakt.sample.samples.ScanRegionsActivity}: java.lang.NullPointerException: Regions collection is null. This is what i get as error but my list size is 1. Also i can't modify the class to extend serializable because it seems to be locked from the kontakt.io sdk which i have implemented.. – diamond Mar 25 '18 at 14:47

1 Answers1

0

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.

Naveen T P
  • 6,955
  • 2
  • 22
  • 29