Greetings.

I'm developing my first Android app, and I'm struck with a very stupid
issue.

I'm inside an Activity class, and after responding to a certain click
event, in some casses I have to start a somewhat long calculation.
Before this I'm trying to update the UI, setting up the text of a
status TextView with the classic "Working, please wait..." message.

Example code is:

    someButton.setOnClickListener(new OnClickListener()
                        {
                            public void onClick(View v)
                            {
                                ClickSomeButton();
                            }
                        });


    protected void ClickSomeButton()
    {
        if (_someCondition)
             //do a lightweight process, and return
        else
        {
 
someTextView.setText(getString(R.string.aPrettyWaitingMessage));
             lenghtyProcess();
        }
    }


As this is the main UI thread, the textview only gets updated after
returning from the event. If fact, I do want the UI to be locked while
the proccess is working, so this is not an issue except for the
TextView update.

After changing the TextView text I suppose it is internally
invalidated and a refresh message is pending. On other platforms,
there is some kind of DoEvents() or DoPendingEvents() functions which
allow UI threads to proccess pending messages before continuing with
the execution.

There is some way of doing this in Android?

Regards

L.

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

Reply via email to