Reputation: 180
I have a reference to an activity, but I don't know the ID of content view for the activity. I need to find all the views in the layout. Can I get the ID of the layout of an activity programmatically at runtime.
Upvotes: 0
Views: 1318
Reputation: 200
Probably, I don't understand your question, but I think you may get views by there ID using:
View v = activity.findViewByID(required ID)
Upvotes: 0
Reputation: 21637
I'm not sure if you can get layout id but you ca try with
activity.getWindow().getDecorView().getRootView()
and from here you can get any child view you want
Upvotes: 3