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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:35:09+00:00 2026-05-21T11:35:09+00:00

I am able to now change an image when pressing OnTouch, for example I

  • 0

I am able to now change an image when pressing OnTouch, for example I press image1 make it invisible and show the one i have underneath it…

Now i want to change an image on runtime, basically I have an array if array[i] = 5; then i want to make image5 invisible?

How can I do this?, I tried it with a

try{
     Thread.sleep(2000);
     }
catch
  {
  }

and it blacks out the screen and then shows the backgroung after 2 seconds but i never see the image get invisible;

i would like to be able to do something like this

for(int i=0;i < array.length; i++)
{
 if(array[i] == 1)
     {
          try
          {
         Thread.sleep(1000);
         ImageView image = (ImageView)findById(myImage01);
         image.setVisibility(View.INVISIBLE);      
         Thread.sleep(1000);
         image.setVisibility(View.VISIBLE);  

           }  
         catch(InterruptedException e) 
            {
            }
       }

}

You get the idea… right now if i do this it will black out the screen and then return to the main layout and do nothing 🙁

Thank you in advance

By the way I am new in Android (please consider 🙁 )

  • 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-21T11:35:10+00:00Added an answer on May 21, 2026 at 11:35 am

    Thread.sleep() is a bad idea because it halts the thread. So if it is the UI-thread, it can not refresh the screen anymore. That’s probably what you observe. Use something like

    new Handler().postDelayed(new Runnable() { 
      void run() {
          image.setVisibility(View.VISIBLE);
      }
    }, 1000);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this working code, but now i need to be able to change
I have put my tns connection into the .ora file and am now able
I have one listview.which contain one image ,text and one button .i had creted
I have an Image and I'm able to draw a rectangle on the image
i have a view with uiimageview i assign this uiimageview image by camera..now i
I have created an AlertDialog. Here I am able to change the backgroundImage of
I have an image pop-up ability on my website, in order to show users
How to change image resolution using jQuery.I have applied a image on body background
With this code, I am able to return one image based off of a
I'm subclassing UITableViewCell to have one image on the far left, then some text

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.