I’m new to android studio and developing apps.
I currently have a list , in my case of people of type ViewList.
I want to make the app display information of these people whenever the user clicks on him.
So for example, if a user clicks Elon Musk, the app will take the user to a page that will display information about Elon musk. The same with other people.
How can I program this without needing to re create a new activity for every person on the list?
TIA
2
Answers
To do this you would need to pass the data through to another activity with an intent, and changing the data in a activity(e.g. displayPerson.class)
Now there is multiple ways of doing this but generally is close to the same concept.
note: Where is the data coming from, is it from firebase or is it hard coded into the app?
You can create one activity and show detailed information about the clicked user in that activity.
You don’t need to create activity for each user. Just one activity is enough.
In the user Detail class
Also, if you are using Database you can just send only the ID number of the user, and fetch all data about the user from database, finally you can display the whole information about that user from database.
But if you don’t want to create an activity, you can create a custom Alert Dialog and display the detailed information of the user in the Alert Dialog.