Im relatively new to the Android world but I have a quick question.
I have a list on one page that has a potentially unlimited amount of rows which will be populated by a database. These will go to different activities based on their type (like Customers etc.) Is it possible to send the user to a specific activity based on which one they tap?
I have seen some solutions that are based on a switch/case, but this seems to be used if you have a list of finite items, and you know the names of those items beforehand.
So, what I am saying is if I use a switch/case solution, how does the application know which buttons goes to which case? Does this need to be defined in the list itself or something in the database?
I can’t provide any code at the moment because it’s not that far into development and I am also under NDA about the project!
You can do that in the
setonitemclicklistener(). This function is called whenever you click on any of the rows of the list view. The position/row number of the item that you have clicked is also passed on to this function.Since you are using Database to Populate your List, you can do this :