가능한 중복 : 나는 어제이 작업을 얻었다
Can't pass an ArrayList<Parcelable> to an activity널 수신 Parcelable
, 나는 코드의 일부 다시 구성했다 지금은 일이 더 이상 작동하지 않습니다. 잠시 그것을 보니 문제가 발견되지 않습니다.
나는 활동에 Parcelables의 ArrayList를 전달 해요 :
ArrayList<MyParcelable> myArrayListOfParcelables = new ArrayList<MyParcelable>();
//...
Intent intent = new Intent(this, ChooseGiftDetailsActivity.class);
intent.putParcelableArrayListExtra(Constants.FOO, myArrayListOfParcelables);
startActivity(intent);
수신기 : 나는 하나를 보내고있다하더라도
ArrayList<Parcelable> parcelableList = (ArrayList<Parcelable>)getIntent().getParcelableArrayListExtra(Constants.FOO);
parcelableList는 항상 null입니다.
MyParcelable은 물론 Parcelable을 확장합니다. 이미 putExtra
를 사용 MyParcelable의 통과 하나 개의 객체를 테스트 항상 작동합니다
Parcelable p = (Parcelable)getIntent().getExtras().getParcelable(Constants.BAR);
또는
MyParcelable p = (MyParcelable)getIntent().getExtras().getParcelable(Constants.BAR);
내가 MyParcelable의 코드 일부 디버그 메시지를 넣어에만을 writting 방법이 목록을 통과 할 때, 나는 참조 실행했지만 결코 읽기 시작하지 않으며 심지어 createFromParcel
도 실행되지 않습니다. 이게 뭐야?
http://prasanta-paul.blogspot.com/2010/06/android-parcelable-example.html – Akram
나는 그것을했지만 작동하지 않는다 – Ixx
그 (것)들 당신은 무언가를 놓치게해야한다 – Akram