Fragment之間傳遞參數

傳遞參數的方法


//要跳轉到的Fragment
MapF f=new MapF();
//傳遞的參數
Bundle args = new Bundle();
args.putString("position","1");
f.setArguments(args);
//跳轉
getFragmentManager().beginTransaction().replace(R.id.car_main_fragment, f).commit();



得到參數


getArguments().getString("position")


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章