is it possible to send bundle args to all fragments using the navigation drawer layout?

You can achieve this using a sharedViewModel across all the fragments.

public class SharedtViewModel extends ViewModel {
    private MutableLiveData<String> amount;

    public void init()
        amount = new MutableLiveData<>();

    public void setAmount(String amount)
    public LiveData<String> getAmount() {
        return amount;

Set the amount value from your Activity.

SharedViewModel viewModel = ViewModelProviders.of(this).get(SharedViewModel.class);

At the end, in every Fragment, you can observe it as follows:

public class FragmentA extends Fragment {
    public void onActivityCreated() {
        SharedViewModel model = ViewModelProviders.of(getActivity()).get(SharedViewModel.class);
        model.getAmount().observe(this, { amount ->
           // Anything here

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top