You shouldn't be using loops like this to delay things, especially if
they end up running on the UI thread.  Instead, create a Handler and
send a message to your future self using postDelayed() or
sendMessageDelayed().

j

On Thu, Aug 13, 2009 at 8:23 AM, bluewind<[email protected]> wrote:
>
> I want to display text1 then a few seconds later text2. Here's what I
> did.
>
> text1.setText("hello");
>
> long t1;
> t1 = SystemClock.uptimeMillis();
> while (SystemClock.uptimeMillis() - t1 < 2000) {        }
>
> text2.setText("hello2");
>
>
> But when I run the program, it delays for 2 seconds, then text1 and
> text2 appear together. I wonder what's wrong. Can someone help?
>
> >
>



-- 
Jeff Sharkey
[email protected]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to