Отправка списка неподдерживаемого типа с помощью parceler

Я пытаюсь отправить Список между двумя Активитами, используя Parceler. Вот что я пытался сделать:

Intent intent = new Intent(SearchServices.this, MainActivity.class);

intent.putExtra(SearchServices.PARCELER_TAG,Parcels.wrap(
                    new Services(Arrays.asList(sortedArrayr)) ));

startActivity(intent); 

sortedArrayr является допустимым массивом DataSnapshot

Intent intent = this.getIntent();

Log.e("onCreate: ", Parcels.unwrap(intent.getParcelableExtra(SearchServices.PARCELER_TAG)).toString() );

Класс посылки

@Parcel(Parcel.Serialization.BEAN)
public class Services {

    List<DataSnapshot> ser;

    public Services(List<DataSnapshot> ser) {
        this.ser = ser;
    }

    public Services() {
    }
}

но я продолжаю получать NullPointerException:

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference

0 ответов

Другие вопросы по тегам