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 7978843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:36:07+00:00 2026-06-04T09:36:07+00:00

I know that changing the ImageView resource is not big deal just using myImageView.setImageResource(mynewImageDrawable)

  • 0

I know that changing the ImageView resource is not big deal just using myImageView.setImageResource(mynewImageDrawable)

but what I want to do is to check the current ImageSource before changing it.

basically, I want to implement my own group radio buttons using imageViews. so every time any imageView is clicked, the oncliked event method will change the Image Resources of my group.

and sorry for my poor English.

regards,
redsea

  • 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-06-04T09:36:09+00:00Added an answer on June 4, 2026 at 9:36 am

    There is no getDrawableId function so you’ll need to do something like set a tag for the ImageView when you change its drawable. For instance, set the drawable id as a tag for the ImageView so you could just get the drawable id from the tag.

    How to do that?

    I’d say 90% of the time, your views wont have any tag on them, so the easiest way is to assume your tag is the only tag:

    myImageView.setTag(R.drawable.currentImage);    //When you change the drawable
    int drawableId = (Integer)myImageView.getTag(); //When you fetch the drawable id
    

    What if I already have a tag on my view

    Android views can host multiple tags at the same time, as long as they have a unique identifier. You’d need to create a unique id resource and add it as the first argument to the setTag method call. Leaving the code like this:

    myImageView.setTag(R.id.myTagId, R.drawable.currentImage); //Set
    int drawableId = (Integer)myImageView.getTag(R.id.myTagId);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that this has already been asked here but the answer (using a
I know that changing the URL is possible, but I thought it is only
I know that it is an easy task, but after changing my code it
I'm curious how plugins work, I just know that instead of changing the code
I know that it's a subject that can raise a lot of debate, but
I know that I should put all the html elements in body tag, but
I know that it's possible to implicitly provide asynchronous interaction using: Asynchronous Delegates Asynchronous
I know that Mono on Android only officially supports Android 1.6 and above, but
I know that there is no API to remove the header row, but I'm
I know that Strawberry Perl portable is out there for Perl 5.10.0, but so

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.