我正在尝试使用intent.puExtra函数传递一个对象,其中我已将已解析的值添加到新活动中。单步执行调试器似乎它添加对象没有问题,但是当调用startActivty()时,我得到一个运行时错误,说明Parcel:无法编组值
我使用以下代码:
JSONObject object;
try
{
HttpClient client = new DefaultHttpClient();
String getURL = "http://www.ondamove.it/English/mob/lastloc.php?email="+Login.eMailId+"";
HttpGet get = new HttpGet(getURL);
HttpResponse responseGet = client.execute(get);
HttpEntity resEntityGet = responseGet.getEntity();
if (resEntityGet != null)
{
String responseinfo = EntityUtils.toString(resEntityGet);
//JSONObject myAwway = new JSONObject(responseinfo);
ArrayList<myObject> listObject = new ArrayList<myObject>();
myObject obj = null;
JSONArray myAwway = new JSONArray(responseinfo);
for(int i = 0; i < 5; i++){
object = myAwway.getJSONObject(i);
obj = new myObject();
obj.setSno(object.getString("sno"));
obj.setDiscription(object.getString("description"));
obj.setTime(object.getString("time"));
listObject.add(obj);
System.out.println("Response : - - " + object);
//System.out.println(object.getInt("place"));
System.out.println(object.getString("description"));
System.out.println(object.getString("time"));
}
Intent intent = new Intent(getApplicationContext(), ProfilePageNormalUser.class);
intent.putExtra("listobject", listObject);
System.out.println("listobject"+listObject);
startActivity(intent);
System.out.println("starting activity");
}
有人可以告诉我如何解决他的问题,以及如何在另一项活动中获得意图的价值?