对象必须实现Serializable,对象代码如下:
import java.io.Serializable;
import android.graphics.drawable.Drawable;
//传送的对象
public class MyApplicationInfo extends Object implements Serializable{
//Your code
}
自定义:AppParcelable
import android.os.Parcel;
import android.os.Parcelable;
import com.tcad.marketassistant.vo.MyApplicationInfo;
public class AppParcelable implements Parcelable {
private MyApplicationInfo info;
public AppParcelable(Parcel source){
info = (MyApplicationInfo)source.readValue(MyApplicationInfo.class.getClassLoader());
}
public AppParcelable(MyApplicationInfo info){
this.info = info;
}
public int describeContents() {
return 0;
}
public void writeToParcel(Parcel dest, int flags) {
dest.writeValue(info);
}
public static final Parcelable.Creator<AppParcelable> CREATOR = new Parcelable.Creator<AppParcelable>() {
public AppParcelable createFromParcel(Parcel source) {
return new AppParcelable(source);
}
public AppParcelable[] newArray(int size) {
// return new AppParcelable[size];
throw new UnsupportedOperationException();
}
};
public MyApplicationInfo getInfo(){
return info;
}
}
调用代码,发送:
AppParcelable parcelable = new AppParcelable(info);
//Info为MyApplicationInfo对象
// 发送对象
intent.putExtra("app_parcelable", parcelable);
startActivity(intent);
接收:
AppParcelable p = getIntent().getParcelableExtra("app_parcelable");
MyApplicationInfo info = p.getInfo();
分享到:
相关推荐
BS EN 71-4-2020 Experimental sets for chemistry and related activities.pdf
activiti5.15 整合springMVC 所需JAR包
Activiti 工作流的简单操作流程 刚入门的可以看看 资源还不错
每个activity都应围绕着用户可执行的特定动作来设计,并且可以启动其它activitie.例如,一个email应用可能可能有一个显示新邮件列表的activity.当用户选择一个邮件,一个新的activity被打开以显示邮件内容. 一个...
【SDK热更系列】Android Hook 技术之 绕过系统对Activity验证 , 原理详见个人博客https://blog.csdn.net/u012573920/
重写流程图生产代码,需要枪原来的图片生产代码复写,原版的颜色生产不支付传入颜色参数,重写之后支持自定义颜色参数!用于区分流程状态
组件之间的通信,接口+实现类,使用注解生成代码方式,无需手动注册,将使用步骤简单化,支持组件间以暴露接口提供服务的方式进行通信。 02.项目组件通信流程 组件app分层 组件通信需求分析 比如业务组件层划分 组件...
主要讲解Activiti框架环境的搭建,能够使用Activiti的API创建23张数据库表,正式开始... 在前一章,介绍了Activitie核心的数据库23张表的特征【添加数据库结构简介链接】,在这里我们就要把Activiti集成到我们工程中了
项目获取数据该项目基于从三星 Galaxy S 智能手机的加速度计收集的数据。 该项目创建了一个名为 ...and_std_features).Uses descriptive activity names to name the activities in the data set (variable "activitie
安装1.1.0 进入然后根据您的操作系统选择一个版本。 在安装完Redmine服务器和API令牌后,您可以在“ My account页面上找到您的API令牌。 对Linux的要求 对于Linux,必须安装libsecret库。... activitie
Start HTCLoggers - Start HTC Logging Activitie Services: You first must run a list to get a dump of all active services. Anything running on your phone will return to the spinner. Select a service ...