Reputation:
I am working on first aid app, now on main activity I have a list of around 40 diseases, when clicked on any item, it moves to next activity showing different content related to that disease. Now my question is, will I make 40 different activities for each disease, or if not then how to make a single activity that will show different content according to clicked disease, and how will I style that text content, because each content may contain different bullets, heading, length of text can be different for each disease.
Upvotes: 0
Views: 707
Reputation: 1869
One activity and when you start it in the intent send also the text images styles or whatever you need
Intent diseaseIntent = new Intent(this, DiseaseActivity.class)
diseaseIntent.putStringExtra("key", textOfDisease);
startActivity(diseaseIntent);
and in DiseaseActivity's onCreate use
String textOfDisease = getIntent().getStringExtra("key", "value if string extra is null");
yourTextView.setText(textOfDisease);
you can add more fields to to intent here is the documentation: https://developer.android.com/reference/android/content/Intent.html Good luck
Upvotes: 2