1、传递ArrayList数据
ArrayList<String>
Intent list_intent = new Intent();
list_intent.putStringArrayListExtra(“key值”, m_list);
list_intent.setClass(MainActivity.this, ListActivity.class);
startActivity(list_intent);
接收
arrayList = getIntent.getExtras().getStringArrayList(“keyzhi”);
ArrayList<Object> Object序列化
ArrayList<Object> object = new ArrayList<Object>();//object类必须implement Serializable
Intent intent = new Intent(A.this, B.class);
Bundle args = new Bundle();
args.putSerializable("obecjtList",(Serializable)object);
intent.putExtra("bundle",args);
startActivity(intent);
2.接受
Intent intent = getIntent();
Bundle args = intent.getBundleExtra("bundle");
ArrayList<Object> object = (ArrayList<Object>) args.getSerializable("obecjtList");
2、传递javabean
首先先要把Bean序列化
Intent intent =new Intent();
intent.putExtra("key值",bean);
intent.setClass(activity, SecondActivity.class);
startActivity(intent);
接收
bean= (Bean) getIntent().getSerializableExtra("key值");
3、传递普通数据
Intent intent =new Intent();
intent.putExtra("key值",“字符等等”);
intent.setClass(activity, SecondActivity.class);
startActivity(intent);
接收
String str =getIntent().getStringExtra("key值");