android - How can I get the image's id on a ImageView? -


Is there a way to find the ID of the image shown on an image view on Android? My case is: I use Picasso to display the image, and if I have not turned the connection, a default image will be printed. Now I want to make a toast which says: "Turn on the connection to show the picture", and I was thinking that I can check image ID. Unfortunately, there is no way like GetDrawableId () or getResourceId () to allow you to get the ID of the resources used in the image view.

But you can do an setTag (id) and getTag () apply a workaround by using ImageView. While tagging, set the tag with ID and you can get back the tag ID using getTag () .


Comments