开发者

Inter thread control handling in Blackberry (Java)

I have the following scenario.

void foo(){
\\do some work
\\invoke a thread to do some heavy work
\\do some work after the thread finishes.
}

I could split this up in this wa开发者_StackOverflow社区y.

void foo1()
{
//pre thread work
//start thread
}

void thread(){
//do heavy work
//invoke foo2() to run from main thread
}

void foo2(){
//do post thread work
}

The question is how do I invoke foo2() (to run in main thread) from the other thread? In Android we have the Handler class for this. How could this be done in Blackberry?


Invoke foo2 using UiApplication.getUiApplication().invokeLater() from your spawned thread.

Documentation here: UiApplication

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜