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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:50:19+00:00 2026-05-15T23:50:19+00:00

I am not able to display the rectangles after a certain delay in code.

  • 0

I am not able to display the rectangles after a certain delay in code.
Here is what I am doing

DashPathEffect dashPath =new DashPathEffect(new float[]{1,0}, 1);

        paint.setPathEffect(dashPath);
        paint.setStrokeWidth(300);
        final int  size =300;

canvas.drawLine(0, size ,100 , size, paint);

try {

            Thread.sleep(4000, 0);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

canvas.drawLine(110, size ,200 , size, paint);


I am not able to notice any delay between these two rectagles in the mobile screen. Both appear at the same time. All I am trying to do is, draw the rectangles one after other with some delay in between. What this code is rather doing is, waiting for 4 seconds and then displaying both rectangles at same time. Thank you.

  • 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-15T23:50:20+00:00Added an answer on May 15, 2026 at 11:50 pm

    You should never sleep in the UI thread. As you saw, this causes the entire program to lock up and wait for the sleep to complete.

    Instead, in this case you might want to look into using a handler. See timed ui-updates for a full description on how to do this.

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

Sidebar

Ask A Question

Stats

  • Questions 507k
  • Answers 507k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Argument v is passed to your function as a pointer… May 16, 2026 at 3:55 pm
  • Editorial Team
    Editorial Team added an answer No need to do this yourself, the Magento system has… May 16, 2026 at 3:55 pm
  • Editorial Team
    Editorial Team added an answer It depends on what the function returns in the case… May 16, 2026 at 3:55 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

i am not able to display some of the currency symbols like afghani(\u060B), kip(\u20AD),
This is my program to display a .x mesh. I am able to display
EDIT: it turns out it's NOT a problem.. pfew! phpMOadmin is not able to
Is it possible to have multiple view of the same display object? (e.g. same-computer
How can I display jpg image which I stored in arraylist in JPanel? Im
I am looking to make video thumbnails like on facebook but I am not
I've used the GUI to create a rectangle that I turned into a button
I have a UIImageView with an image in it. I have rotated the image
I would like to create a game with an endless (in reality an extremely
Has anyone out there created a version of GDI32.dll that takes advantage of hardware

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.