I'm trying to send a List between two Activites using Parceler. This is what i've been trying to do:
Intent intent = new Intent(SearchServices.this, MainActivity.class);
intent.putExtra(SearchServices.PARCELER_TAG,Parcels.wrap(
new Services(Arrays.asList(sortedArrayr)) ));
startActivity(intent);
sortedArrayr
is a valid array of DataSnapshot
Intent intent = this.getIntent();
Log.e("onCreate: ", Parcels.unwrap(intent.getParcelableExtra(SearchServices.PARCELER_TAG)).toString() );
Parceler class
@Parcel(Parcel.Serialization.BEAN)
public class Services {
List<DataSnapshot> ser;
public Services(List<DataSnapshot> ser) {
this.ser = ser;
}
public Services() {
}
}
but I keep getting a NullPointerException
:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference