Reputation: 34823
Is there any way to refer more than one widget (ui controls) by a single id
For example
i have many ImageView
with same android:id="myimageview"
And in my activity
myimageview = (ImageView)findViewById(R.id.myimageview);
So if i set an image using
myimageview.setImageBitmap(somebitmap);
i need that image in all of my Imageview with id myimageview
But when i tried this only one of imageview got this change.
Any idea to do this.
Thank you.
Upvotes: 0
Views: 163
Reputation: 11537
No you can't.
At least I did not see a API method in the documentation yet. ID is UNIQUE (stands for identifier). You can use a TAG (android:tag
in your XML file) and then get the parent View.
Then, you might want to try an function like getTouchables() on your parent view and use all the views that match when calling getTag.
Upvotes: 2