首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

Bundle传递对象后,内存中该对象地址的有关问题

2013-12-22 
Bundle传递对象后,内存中该对象地址的问题Bundle bundle new Bundle()bundle.putSerializable(custom

Bundle传递对象后,内存中该对象地址的问题
Bundle bundle = new Bundle();bundle.putSerializable("custom", MyApplication.getInstance().getCustom());mFragmentPersonal.setArguments(bundle);



custom = (Custom)getArguments().getSerializable("custom");



然后再通过MyApplication.getInstance().getCustom()的对象一直为null

没看源代码,以后探索,我觉得是Bundle在传递对象后,只能通过Key的方式获取,该对象以前的内存地址内容清空了。

?

然后我在考虑 是不是只是清空了该内存地址的一个引用,于是使用

?

?

Custom cus =  MyApplication.getInstance().getCustom();bundle.putSerializable("custom", cus);

?

结果还是为null,说明不是清空一个引用

?

确认的之前和之后的Application是同一个对象

?

热点排行