问题描述
我想开发一个风暴2黑莓应用程序。我试图从应用程序的不同实例更新时的LabelField面临的一个问题。
该计划是工作的罚款,而无需更新此的LabelField,但是当我尝试添加code到更新的文字,就变成了的setText行后没有反应。
我缺少的东西吗?
公共类AgentTrackerScreen扩展MainScreen
{
公共静态的LabelField _outputText;
...
}公共类BtService实现Runnable
{
...
公共无效的run()
{
AgentTrackerScreen._outputtext.settext(
东西:+ btListener.vecDevices.size());
}
...
}
您必须在事件线程上的所有用户界面的修改,否则这样做之前,锁定用户界面。请参见的详情。
(顺便说一句,这是许多用户界面系统的共同要求。摇摆在Java SE有此要求,所以不WPF在Windows上。)
I am trying to develop a BlackBerry app for a Storm2. I am facing a problem when trying to update a LabelField from a different instance of the app.
The program is working fine without updating this LabelField, but when I tried to add the code to update the text, it becomes unresponsive after the "settext" line.
Am I missing something?
public class AgentTrackerScreen extends MainScreen
{
public static LabelField _outputText;
...
}
public class BtService implements Runnable
{
...
public void run()
{
AgentTrackerScreen._outputtext.settext(
"Something: " + btListener.vecDevices.size());
}
...
}
You must make all user interface modifications on the event thread, or else lock the user interface before doing it. See BlackBerry UI Threading Basics for details.
(BTW, this is a common requirement in many user interface systems. Swing in Java SE has this requirement. So does WPF on Windows.)
这篇关于黑莓 - 动态的LabelField问题更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!