borod
borod

Reputation: 43

How to access/get the resource id of the image in an ImageButton (Android)

I have an ImageButton, and I want to use the Image associated with in the OnClick event.

I found this: Android ImageButton - determine what resource is currently set

But I wonder is there any built in way to find the resourceid of the image in an ImageButton in this two cases: 1. The android:src was set in the xml and never changed. 2. The Image was changed in code.

Thank You!

Upvotes: 4

Views: 6880

Answers (1)

Matthew
Matthew

Reputation: 44919

This isn't possible.

I'd listen to Mark:

just use setTag() and getTag() to associate and retrieve custom data for your ImageView.

Upvotes: 3

Related Questions