无法在Android中传递Listobjects
我想通过Intent将对象列表传递给其他活动,下面是我目前尝试的代码无法在Android中传递Listobjects,android,android-intent,bundle,Android,Android Intent,Bundle,我想通过Intent将对象列表传递给其他活动,下面是我目前尝试的代码 public List<Reportgetter> reportlist; Here reportlist has some values. Intent graph= new Intent(showdetails.this,Graph.class); Bundle bundle = new Bundle(); bundle.putParcela
public List<Reportgetter> reportlist;
Here reportlist has some values.
Intent graph= new Intent(showdetails.this,Graph.class);
Bundle bundle = new Bundle();
bundle.putParcelable("list", (Parcelable) reportlist);
graph.putExtras(bundle);
startActivity(graph);
**Graph Class**
I am receiving like this,
Bundle extras = getIntent().getExtras();
if(extras!=null)
{
reportlist = extras.getParcelable("list");
}
公共列表报告列表;
这里reportlist有一些值。
意向图=新意向(showdetails.this,graph.class);
Bundle=新Bundle();
bundle.putParcelable(“列表”,(Parcelable)报告列表);
图.putExtras(bundle);
星触觉(图形);
**图形类**
我是这样接受的,,
Bundle extras=getIntent().getExtras();
如果(附加值!=null)
{
reportlist=extras.getParcelable(“列表”);
}
但我有一些例外。请帮我解决这个问题
问候
priya试试这个
Intent graph = new Intent(showdetails.this,Graph.class);
graph.putParcelableArrayListExtra("list", reportlist);
startActivity(graph);
在Grpah活动中
Intent intent = getIntent();
reportList = intent.getParcelableArrayListExtra("list");
要使其工作,Reportgetter类必须实现
欢迎使用StackOverflow。请将例外情况的详细信息发布给我们,以便我们可以帮助您
由于您使用的是可包裹对象,我猜您的异常是android.os.BadParcelableException
这源于您的类实现
Reportgetter
。请按照此处的说明操作:。您能提供您收到的例外情况吗“某些异常”相当模糊,不会向其他人提供问题的提示。@user1993392 Reportgetter类是否实现了Parcelable?