Intent如何传递对象

http://android-zhang.iteye.com/blog/1388640
2种方法
1.Serializable
2.Parcelable

感觉Serializable比Parcelable更简单,方便

传递ArrayList实现Parcelable更简单

传递:
 Intent mIntent = new Intent(this,ObjectTranDemo1.class);  
        Bundle mBundle = new Bundle();  
        mBundle.putSerializable(SER_KEY,mPerson);  
        mIntent.putExtras(mBundle);  
          
        startActivity(mIntent);  


获取:
 Person mPerson = (Person)getIntent().getSerializableExtra(ObjectTranDemo.SER_KEY)

猜你喜欢

转载自macleo.iteye.com/blog/1765951