activity中传值给fragment

/*
//创建 Fragment 实例
detail fragment = new detail();

//构建 Bundle
Bundle bundle = new Bundle();
//设置数据
bundle.putString("account", this.account);
//绑定 Fragment
fragment.setArguments(bundle);


FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.nav_taskframent, fragment);
fragmentTransaction.commit();

*/
posted @ 2023-04-09 09:01  小趴菜且能喝66  阅读(17)  评论(0编辑  收藏  举报