[英]putExtra How send to new Activity Arraylist <STRING []>
How send send Arraylist to another activity?? 如何发送发送Arraylist到另一个活动?
@Override
protected void onPostExecute(ArrayList<String[]> s) {
Intent newActivity = new Intent(main,ListadoUltimosRegistros.class);
newActivity.putExtra("LR",(ArrayList<String[]>)s);
newActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
main.startActivity(newActivity);
}
you can use data serializable class and use in put extra statements
Intent i = new Intent(getApplicationContext(), DataList.class);
i.putExtra("password", (Serializable) contactList);
startActivity(i);
//and fetch the data as a
if(getIntent().getSerializableExtra("password")!=null)
{
con=(ArrayList<Contact>)getIntent().getSerializableExtra("password");
email_mobile = contactList.get(0)._emnumber;
pass__word = contactList.get(0)._password;
}
you can send your custom object as : 您可以将自定义对象发送为:
intent.putExtra("MyClass", obj);
// To retrieve object in second Activity
getIntent().getSerializableExtra("MyClass");
Try this. 尝试这个。
On your onPostExecute for Sending. 在您的onPostExecute上进行发送。
Intent newActivity = new Intent(main,ListadoUltimosRegistros.class);
ArrayList<String> myList = new ArrayList<String>();
newActivity.putExtra("mylist", myList);
newActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
newActivity.startActivity(newActivity);
on Receiving end use this. 在接收端使用此。
ArrayList<String> myList = (ArrayList<String>) getIntent().getSerializableExtra("mylist");
Try this. 尝试这个。
For sending: 发送:
i.putStringArrayListExtra("list", your list);
For retrieving: 检索:
getIntent().getStringArrayListExtra(list)
Where i
is the Intent object. 其中
i
是Intent对象。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.