import android.os.Parcel;
import android.os.Parcelable;

class VideoItem implements Parcelable {

long id;
String path;
String title;
String duration;
String folder;
String mimeType;
long size;

public VideoItem() {
// TODO Auto-generated constructor stub
}

public VideoItem(long id, String path, String title, String duration, String folder, String mimeType, long size) {
super();
this.id = id;
this.path = path;
this.title = title;
this.duration = duration;
this.folder = folder;
this.mimeType = mimeType;
this.size = size;
}

public long getId() {
return id;
}

public void setId(long id) {
this.id = id;
}

public String getPath() {
return path;
}

public void setPath(String path) {
this.path = path;
}

public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title;
}

public String getDuration() {
return duration;
}

public void setDuration(String duration) {
this.duration = duration;
}

public String getFolder() {
return folder;
}

public void setFolder(String folder) {
this.folder = folder;
}

public String getMimeType() {
return mimeType;
}

public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}

public long getSize() {
return size;
}

public void setSize(long size) {
this.size = size;
}

public static final Parcelable.Creator<VideoItem> CREATOR = new Creator<VideoItem>() {

@Override
public VideoItem[] newArray(int size) {
return new VideoItem[size];
}

@Override
public VideoItem createFromParcel(Parcel source) {
VideoItem item = new VideoItem();
item.id = source.readLong();
item.path = source.readString();
item.title = source.readString();
item.duration = source.readString();
item.folder = source.readString();
item.mimeType = source.readString();
item.size = source.readLong();
return item;
}
};

@Override
public int describeContents() {
return 0;
}

@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(id);
dest.writeString(path);
dest.writeString(title);
dest.writeString(duration);
dest.writeString(folder);
dest.writeString(mimeType);
dest.writeLong(size);
}
}

Note: CREATOR must be a static method

-----------------------------sent----------------------------------
Intent intent = new Intent(A.this, B.class);
Bundle bundle = new Bundle();
bundle.putParcelableArrayList("videoitems", mFolderMap.get(mFolderList.get(position).folder));
intent.putExtras(bundle);
startActivity(intent);

---------------------------receive------------------------------
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
mBackTitle.setText(bundle.getString("title"));
mVideoItems = bundle.getParcelableArrayList("videoitems");
}

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Android(安卓)实现 Launcher
  2. Android实现手机摄像头的自动对焦
  3. Android(安卓)系统启动流程
  4. Android的 EditText的inputType类型
  5. 在Maven项目中使用Android(安卓)Support
  6. Android(安卓)error 处理-有空就更新
  7. Android(安卓)ActionBar和ToolBar的使用
  8. Android控件之AutoCompleteTextView、Mul
  9. Android(安卓)CoordinatorLayout实战案例
  10. android TabLayout 和 RecyclerView 联动