我試圖從適配器通過串包府ti'm到片段我片段捆綁返回NULL片段中調用時
及彼空是我的代碼添加字符串捆綁
Bundle bundle=new Bundle();
bundle.putString("id",expense_id);
AddExpenseFragment fragment=new AddExpenseFragment();
fragment.setArguments(bundle);
UiActivity.startAddExpense(context);
這是我的代碼來檢索片段
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view=inflater.inflate(R.layout.activity_fragment_add_expense,container,false);
String id=this.getArguments().getString("id");
return view;
}
捆綁值,我從我的recyclerView適配器類傳遞價值捆綁
你在做什麼'startAddExpense'方法? – David
@David它打電話意圖啓動片段活動 – rookieDeveloper
請您告訴我你的片段事務提交你的片段的行嗎?我假設你開始不是你通過參數 – David