Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6092401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:26:17+00:00 2026-05-23T12:26:17+00:00

A bit wierd problem: Is it possible to get back id or/and a name

  • 0

A bit wierd problem:

Is it possible to get back id or/and a name of active resource in an ImageView? That’s the code.

ImageView photo = (ImageView) findViewById(R.id.placeForPhoto);
//here I choose random photo from drawable (photo 1 to photo 10)
//and then I show it on the screen as below
photo.setImageResource(R.drawable.photo1); //or photo2 or photo3 or...

In the other part of the code I would like to check which photo is atm presented in placeForPhoto. If it’s R.drawable.photo1 or R.drawable.photo2 or…

So what I need is just smth like to have a possibility to achieve such a comparison:

if ([presented atm photo in ImagView photo] == R.drawable.photo1) 
{do something}
else if ([presented atm photo in ImagView photo] == R.drawable.photo2) 
{do smth different}
else {...}

I tried:
photo.getID() but it returns ID of placeForPhoto not for the resource inside;

photo.getResource() but it returns some other value different than id of photo

getResource().getIdentifier() but it gives id when you have the name and I don’t have the name (or maybe it’s possible to get the name from ImageView photo?)

getResources().getResourceName() but then I have to have id which I’m just looking for.

Thx in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:26:18+00:00Added an answer on May 23, 2026 at 12:26 pm

    Is it possible to get back id or/and a name of active resource in an ImageView?

    No, because an ImageView does not have to hold a resource. It could hold a bitmap obtained by other means (e.g., download from the Web).

    So what I need is just smth like to have a possibility to achieve such a comparison

    Store the ID in a data member of the activity, or in the tag of the ImageView (i.e., setTag() and getTag()).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a bit of a wierd problem. (.NET 3.5sp1) I have a UserControl
I'm having a bit of a problem with a very weird side effect that's
I have a wierd problem that i need to work out how to resolve,
all. I'm having a bit of weird problem with client server program. I have
I'm having a bit of a weird problem to do with scope of variables.
Weird question, but one that puzzles me a bit. In the old days when
Still a bit new to the concept of M-V-VM in WPF, here's my problem:
I'm a bit confused with the input's of Ruby. Whenever I try to get
I'm having a bit weird problem with WinForm which seems to refuse to close
i'm having a bit of a weird problem. I programmed a asp.net mvc app

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.