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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:33:17+00:00 2026-06-08T05:33:17+00:00

I have a the following code: final ImageButton bgreen = (ImageButton) findViewById(R.id.imageButton1c); bgreen.setImageResource(R.drawable.xgp); gHandler.postDelayed(greenRunnable,

  • 0

I have a the following code:

final ImageButton bgreen = (ImageButton) findViewById(R.id.imageButton1c);
bgreen.setImageResource(R.drawable.xgp);
gHandler.postDelayed(greenRunnable, delay); // this reverses the above two lines in a second

However, I have found that the image change DOES NOT actually occur until all other commands added before AND AFTER it are completed and then it has an empty queue and is waiting for an onclick listener. Why is this? Is there a better way? It ends up that this and undoing this happens sequentially even though I used a handler/runnable combo (which I believe is a completely different thread?) to delay the undoing.

Can I use a different method like:

ButtonName.setImageResource(R.drawable.ImageName);  

that might perform better?

I need to do the clicking as a demonstration (ie without user interaction) and it is this part that is the problem. ie I can’t simply do this in XML, e.g.:

<item android:state_pressed="true"
android:drawable="@drawable/login_selected" /> <!-- pressed -->
  • 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-08T05:33:19+00:00Added an answer on June 8, 2026 at 5:33 am

    This seems to be related to using the sleep command. Cleverly using Handler/Runnable combos helps here.

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

Sidebar

Related Questions

I have the following Java code: final Future future = exeService.submit( new Runnable() {
I have the following code: private static final Set<String> allowedParameters; static { Set<String> tmpSet
I have the following code: public void post(String message) { final String mess =
I currently have code that does the following: private final static ExecutorService pool =
I have the following code in my app: public static final boolean DEBUG =
I have the following snippet of java code: final Class<?> junitCoreClass = AccessController.doPrivileged( new
Assuming that I have the following code: final Catalog catalog = createCatalog(); for (int
Say I have the following code: private Integer number; private final Object numberLock =
I have the following code: import java.io.PrintStream; import java.io.UnsupportedEncodingException; import java.util.Locale; public final class
have the following code to run an mp3 podcast public void playPodcast( final Uri

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.