'How I can Replace Multiple Fragments with by clicking on a single button?
I want to replace my 5 fragments by clicking on a single button. The button is fix only the fragments replace. Please help me how can I do that? Here is my code
public class MainActivity extends AppCompatActivity {
ActivityMainBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityMainBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);
getSupportFragmentManager().beginTransaction().replace(R.id.container
,new SelectWeightFragment()).commit();
replaceFragment();
}
private void replaceFragment() {
binding.btnNext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
