传递数据给Fragment的方法
来源:互联网 发布:矢量图制作知乎 编辑:程序博客网 时间:2024/05/30 07:13
原文:http://stackoverflow.com/questions/7149802/how-to-transfer-some-data-to-another-fragment
Use a Bundle. Here's an example:
Fragment fragment = new Fragment();Bundle bundle = new Bundle();bundle.putInt(key, value);fragment.setArguments(bundle);
Bundle has put methods for lots of data types. Seehttp://developer.android.com/reference/android/os/Bundle.html
Then in your Fragment, retrieve the data (e.g. in onCreate()) with:
Bundle bundle = this.getArguments();
if(bundle
!=null){int myInt = getArguments().getInt(key, defaultValue);}
- 传递数据给Fragment的方法
- activity给fragment传递数据
- Fragment.setArguments()方法向fragment对象传递数据的重要作用
- 把activity传递给FragmentActivity的数据再传递给FragmentActivity的子Fragment
- Fragment的数据传递
- fragment的数据传递
- Fragment的数据传递
- Fragment的数据传递
- android Fragment传递数据方法
- Activity如何传递数据给Fragment——回调方法
- Activity和Fragment之间传递数据的方法
- Fragment与Fragment之间的数据传递
- Fragment之间的数据传递
- fragment间的数据传递
- 解决 activity 和 fragment 传递数据方法。
- Activity与fragment之间数据传递方法
- Android Fragment的使用 九 Fragment传输数据给Fragment
- gSOAP传递数据给service方法
- BUG python2.7 httplib message_body
- nbtstat
- 下载文件用~
- Zsh 技巧三则
- 页面静态化思路
- 传递数据给Fragment的方法
- Github安卓开源项目编译运行
- 难得有一篇文章来仔细梳理cowboy bebop的种种.
- java poi操作EXCEL
- Message file sp1<lang>.msb not found
- 反向代理服务器
- 一个程序只运行一个实例
- 屏蔽整段IP和iptables应用
- Protocol Buffers Encoding