Не работает передача в bottomsheetdialogfragmemt
Метод передачи в фрагмент из активити
holder.texttovarprice.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
FragmentTransaction fragmentTransaction=getSupportFragmentManager().beginTransaction();
TovarBottomOpisFragment tovarBottomOpisFragment=new TovarBottomOpisFragment();
tovarBottomOpisFragment.show(getSupportFragmentManager(),tovarBottomOpisFragment.getTag());
Bundle data=new Bundle();
data.putString("ProductTime",model.getProductTime());
tovarBottomOpisFragment.setArguments(data);
tovarBottomOpisFragment.setArguments(data);
fragmentTransaction.replace().commit();
}
});
Прием
getArguments().getString("ProductTime")
В фрагменте ничего не приходит равно нулю. Как переделать?
Ответы (1 шт):
Автор решения: woesss
→ Ссылка
holder.texttovarprice.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
TovarBottomOpisFragment tovarBottomOpisFragment=new TovarBottomOpisFragment();
Bundle data=new Bundle();
data.putString("ProductTime",model.getProductTime());
// сначала передаём аргументы
tovarBottomOpisFragment.setArguments(data);
// потом показываем диалог
tovarBottomOpisFragment.show(getSupportFragmentManager(),tovarBottomOpisFragment.getTag());
}
});