how to add a button in one the navigation drawer fragment so that when the user click he is directed to another sub fragment of that previous fragment
-
how to add button in the of the menu item fragment of the navigation drawer so that when the user click on the button he is redirected to anther sub fragment but one issue here is I am using the android custom navigation drawer implementation below is my try
package com.example.entertainmentlab.ui.store;
import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProviders; import com.example.entertainmentlab.R; import com.example.entertainmentlab.ui.setting.SettingViewModel; public class StoreFragment extends Fragment { private StoreViewModel StoreViewModel; public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { StoreViewModel = ViewModelProviders.of(this).get(StoreViewModel.class); View root = inflater.inflate(R.layout.fragment\_store, container, false); final ImageView MusicButton = root.findViewById(R.id.music\_btn); MusicButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { Fragment fragment = new BlankFragment(); FragmentManager fragmentManager = getActivity().getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.nav\_host\_fragment\_container, fragment); fragmentTransaction.addToBackStack(null); fragmentTransaction.commit(); }catch (Exception e ){ Toast.makeText(getActivity(), "erro "+e, Toast.LENGTH\_SHORT).show(); } } }); // StoreViewModel.getText().observe(getViewLifecycleOwner(), new Observer() { /
-
how to add button in the of the menu item fragment of the navigation drawer so that when the user click on the button he is redirected to anther sub fragment but one issue here is I am using the android custom navigation drawer implementation below is my try
package com.example.entertainmentlab.ui.store;
import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProviders; import com.example.entertainmentlab.R; import com.example.entertainmentlab.ui.setting.SettingViewModel; public class StoreFragment extends Fragment { private StoreViewModel StoreViewModel; public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { StoreViewModel = ViewModelProviders.of(this).get(StoreViewModel.class); View root = inflater.inflate(R.layout.fragment\_store, container, false); final ImageView MusicButton = root.findViewById(R.id.music\_btn); MusicButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { Fragment fragment = new BlankFragment(); FragmentManager fragmentManager = getActivity().getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.nav\_host\_fragment\_container, fragment); fragmentTransaction.addToBackStack(null); fragmentTransaction.commit(); }catch (Exception e ){ Toast.makeText(getActivity(), "erro "+e, Toast.LENGTH\_SHORT).show(); } } }); // StoreViewModel.getText().observe(getViewLifecycleOwner(), new Observer() { /
So what exactly is the problem?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles