找回所有类似的问题,但没有结果。 我无法将一个从intentService实现parcelable的ojbect传递给一个Activity。将数据从活动传递到另一活动时,相同的代码正常工作。即使可以传递ParcelableArrayListExtra也不可以传递对象。它是在我的项目中传递对象的一个要求。下面 代码给出(不要有权发布完整的代码,并且整个代码工作,除了这些线路) CODE: IntentService:不能将作为putExtra的Parcelable对象从IntentService传递到另一活动
Intent action = new Intent(this, QuizActivity.class);
intent.putParcelableArrayListExtra("userList",name);
Random position = new Random();
int randomPosition =position.nextInt(3);
intent.putExtra("selectedUser",name.get(randomPosition));
action.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
SecondActivity:
List<User> userList= getIntent().getParcelableArrayListExtra(EXTRA_INSECTS);
Insect selected = getIntent().getExtras().getParcelable("selectedUser");
请解释**详细**什么 “我无法通过一个ojbect实现parcelable从intentService到活动” 是指什么“但不是可以parcelable的对象”的意思。你的症状是什么? – CommonsWare
你收到异常吗? – Alex
您的测试设备使用哪个api级别? – mac229