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

  • Home
  • SEARCH
  • 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 6804593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:29:07+00:00 2026-05-26T19:29:07+00:00

My XML file contain four buttons, lets say Button A, B, C and Confirm.

  • 0

My XML file contain four buttons, lets say Button A, B, C and Confirm. In my main file, when Button A is clicked, Button B will get the image background of Button A. That posts no problems. However, my problem is that I wanted that when Confirm is clicked, Button C will have another background image depending on Button B’s background image. How do I do that? To simplify, I do not know how to check the image background of Button B (which depends on Button A) and it will determine the image of Button C.

Cheers!

  • 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-26T19:29:08+00:00Added an answer on May 26, 2026 at 7:29 pm

    This will copy the background from buttonB to buttonC:

    buttonC.setBackgroundDrawable(buttonB.getBackground());
    

    To see what background you have you can use the Views tag. Let’s use some strings to identify the backgrounds:

    We set some background on buttonA that we call “BACK1”,then also call buttonA.setTag("BACK1");

    When you later copy the background from A->B, also do buttonB.setTag(buttonA.getTag());

    Now whenever you need to know what background buttonB have, just check the tag with smth like:

    if ( "BACK1".equals(buttonB.getTag()) ) { /* We have BACK1 */ }
    

    Of course you can use smth better in the tag, an resource ID so you can use a switch statement.

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

Sidebar

Related Questions

I have a custom XML file format which can contain blocks of code within
I am learning JPA. I read about persistence.xml file. It can contain more that
I have a main activity with this layout file: <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android
Guys i have a xml file who contain this info: <?xml version=1.0 encoding=utf-8?> <ES>
i have created a template xml file witch contain some words like {contentname}. i
I'm writing an xml file. The file must contain the &q inside it and
I have an XML file, that may or may not contain a node called
I have designed an xml file contain nine images i.e.., 3 rows each row
i have an xml file which contain some data like: <?xml version=1.0 encoding=utf-8 ?>
I'm parsing an XML file which can contain localized strings in different languages (at

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.