Hi I'm an android beginner just figuring things out,
and now I'm stuck for a couple of days figuring out how to create 1 activity and change its content based on what button the user selects.
So I'm building a small project which is a first aid application where there are at least 15-25 list of buttons that will display different kinds of first aid tutorials. what is the best way to implement this?
so far I've managed to create a list of buttons that directs users to another activity
.
After clicking the burns button, these steps will pop up and each of them was clickable and will direct the user to another activity which will elaborate that steps with image and video

I've already tried to use 1 activity and send information using intent.putExtra() however the problem is I can't change the button destination of each step (the elaboration part) it changed the information for each step but when it's clicked. It just leads me to the same elaboration part for (burns step).
I am sure there are better ways of implementing this, instead of creating another activity for every button clicked just show little information. any help will be very much appreciated please note that I am really just a beginner, an informative explanation will genuinely help me a lot thankyou.
Code (list_of_firstAid.java):
buttonBurns.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), burnsActivity.class);
intent.putExtra("procedure_1", getResources().getString(R.string.burns_procedure_1));
intent.putExtra("procedure_2", getResources().getString(R.string.burns_procedure_2));
intent.putExtra("procedure_3", getResources().getString(R.string.burns_procedure_3));
intent.putExtra("procedure_4", getResources().getString(R.string.burns_procedure_4));
intent.putExtra("procedure_5", getResources().getString(R.string.burns_procedure_5));
intent.putExtra("note_procedure_1", getResources().getString(R.string.burns_note_1));
startActivity(intent);
}
});
Code: (burnsActivity.java)
public void process(View view){
if(view.getId() == R.id.burnsStep1)
{
Intent intent = new Intent(burnsActivity.this, displayInfoActivity.class);
intent.putExtra("step_1", getResources().getString(R.string.firstaid_burnsactivity_information_number_1_bullet_1));
intent.putExtra("image_1", R.drawable.round_bk2);
intent.putExtra("step_2", "this is step 2");
startActivity(intent);
}
else if(view.getId() == R.id.burnsStep2)
{
Intent intent = new Intent(burnsActivity.this, displayInfoActivity.class);
intent.putExtra("step_1", getResources().getString(R.string.firstaid_burnsactivity_information_number_2_bullet_1));
intent.putExtra("image_1", R.drawable.round_bk3);
intent.putExtra("step_2", "");
startActivity(intent);
}
else if (view.getId() == R.id.burnsStep3)
{
Intent intent = new Intent(burnsActivity.this, displayInfoActivity.class);
intent.putExtra("step_1", getResources().getString(R.string.firstaid_burnsactivity_information_number_3_bullet_1));
intent.putExtra("image_1", R.drawable.round_bk5);
intent.putExtra("step_2", getResources().getString(R.string.firstaid_burnsactivity_information_number_3_bullet_2));
startActivity(intent);
}
else if (view.getId() == R.id.burnsStep4)
{
Intent intent = new Intent(burnsActivity.this, displayInfoActivity.class);
intent.putExtra("step_1", getResources().getString(R.string.firstaid_burnsactivity_information_number_4_bullet_1));
intent.putExtra("image_1", R.drawable.round_bk5);
intent.putExtra("step_2", getResources().getString(R.string.firstaid_burnsactivity_information_number_4_bullet_2));
startActivity(intent);
}
else if (view.getId() == R.id.burnsStep5)
{
Intent intent = new Intent(burnsActivity.this, displayInfoActivity.class);
intent.putExtra("step_1", getResources().getString(R.string.firstaid_burnsactivity_information_number_5_bullet_1));
intent.putExtra("image_1", R.drawable.round_bk5);
intent.putExtra("step_2", getResources().getString(R.string.firstaid_burnsactivity_information_number_5_bullet_2));
startActivity(intent);
}
else if (view.getId() == R.id.burnsNote1)
{
Intent intent = new Intent(burnsActivity.this, displayInfoActivity.class);
intent.putExtra("step_1", getResources().getString(R.string.firstaid_burnsactivity_information_number_6_bullet_1));
intent.putExtra("image_1", R.drawable.round_bk5);
intent.putExtra("step_2", getResources().getString(R.string.firstaid_burnsactivity_information_number_6_bullet_2));
startActivity(intent);
}
EDIT: The above code will change the information of each of these steps.
however, these steps are also clickable. so when I reuse this activity for bleeding (for example) and change the text of each step it works but when its clicked it shows the same information I put on burnsActivity.
