Killer Killer - 1 month ago 9
Android Question

How to retrieve data from view injected programmatically without id

I have a scroll view and a linear layout. Depending upon the data i am getting i generate a view respectively and inject it to the main layout.

Now each view contains certain value but no id as they are injected dynamically. How to access the value from each for further processing.
I have tried on click listener but did not get good results.
I want to add one thing these views can vary some are multiple. some are single etc.
I need your valuable suggestion and will post code if necessary.

Answer Source

As already mentioned in the comments: View has a setId(int id) method.
Use that to access your view. Store them in some list, map or write to file system for further usage. You could also use SharedPreferences to pass the information of the views to another intent.