Hi Michael, You should probably post stuff like this in the android beginners or android developers group instead.
In any case, whenever you change state in a UI component that will affect its appearance (such as setText), the change will not be reflected immediately, but will be reflected the next time the UI thread's loop gets around to rendering the change. Since this painting of the TextView happens "later" you only see the text you passed in the second call to setText. - Mike On Feb 19, 3:48 pm, Michael Lam <[email protected]> wrote: > hi, > > i tried to do this: > > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > > setContentView(R.layout.main); > > t=new TextView(this); > > t=(TextView)findViewById(R.id.TextView01); > t.setText("Step One: blast egg"); > > try { > Thread.sleep(10000); > } catch (InterruptedException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > > t.setText("Step Two: fry egg"); > > but for some reason, only the second text shows up when i run it. i > think it might have > > something to do with the Thread.sleep() method blocking. so can > someone show me how to > > implement a timer "asynchronously"? > > thanks. -- You received this message because you are subscribed to the Google Groups "Android Discuss" 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-discuss?hl=en.
