Fragment静态传值
来源:互联网 发布:万圣节服装淘宝网 编辑:程序博客网 时间:2024/06/08 12:19
public class ContentFragment extends Fragment { private View view; private static final String KEY = "arg"; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { view = inflater.inflate(R.layout.content_fragment, container, false); return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); TextView textView = (TextView) view.findViewById(R.id.text_content); String str = (String) getArguments().get(KEY); textView.setText(str); } /** * Fragment静态传值 * @param str * @return */ public static ContentFragment newInstance(String str) { ContentFragment fragment = new ContentFragment(); Bundle bundle = new Bundle(); bundle.putString(KEY,str); fragment.setArguments(bundle); return fragment; }}
阅读全文
0 0
- fragment静态传值
- Fragment静态传值
- Fragment静态传值
- Fragment静态传值(RecyclerView,接口回调)
- 静态Fragment
- 静态Fragment
- Fragment的使用(静态,动态添加碎片;生命周期以及传值)
- android 静态创建fragment
- Fragment静态使用
- fragment的静态加载
- 静态Fragment的使用
- Fragment之静态使用
- 静态加载Fragment
- 静态加载fragment
- Fragment静态使用
- 静态加载Fragment
- Fragment静态添加
- 静态fragment传值
- 搭建GitLab+Jenkins持续集成环境图文教程
- 利用字典将两个通讯录的文本合并为一个文本
- 判断登录的状态
- 构造根文件系统之init进程分析
- HTML基础学习-14-font字体属性设置
- Fragment静态传值
- BP人工神经网络的介绍与实现
- 移动平台对 META 标签的定义
- C与C++的区别
- 贪心算法
- MD5
- TCP多线程服务器
- 论一块优秀开发板的自我修养
- 常用端口总结