设为首页 加入收藏

TOP

Android Intent 序列化反序列化
2014-11-24 01:40:26 来源: 作者: 【 】 浏览:2
Tags:Android Intent 序列化

查看Intent 的源代码, 发现类中已经实现序列化功.


序列化


intent.toURI();


反序列 化使用:


Intent.parseUri(uriString, 0);


先看序列化:


intent.toURI();


Intent intent = new Intent("cn.eben.bookshelf.VIEW");

intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);


String intnetUri = intent.toURI();


//序列化后:


//#Intent;action=cn.eben.bookshelf.VIEW;launchFlags=0x10000000;end


反序列 化使用:


Intent.parseUri(uriString, 0);


Intent i;
try {
i = Intent.parseUri(uriString, 0);
context.startActivity(i);
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


简单方便.


解决上次的问题.


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Android Intent 使用 Parcel 反序.. 下一篇Android 应用启动速度优化

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: