【发布时间】:2015-06-14 17:54:39
【问题描述】:
我来自 Android,现在我正在为 Blackberry 学习。
在 Android 中访问其他类,我们可以在 java 中传递类似于“this”的上下文。如何在黑莓中做到这一点?问题出在黑莓中,我想在其他类中添加 Screen 类的字段/管理器,代码示例:
public final class MyScreen extends MainScreen
{
//Creates a new MyScreen object
public MyScreen()
{
// Set the displayed title of the screen
setTitle("MyTitle");
process1 x = new process1(); // will add the labelfield
}
}
this 在其他文件类中
public class process1
{
public process1()
{
//i'm trying to get the context of MyScreen so i can add the field in this class
MyScreen.add(new Labelfield("test"));
//but its giving error with the message cannot make static reference
}
}
【问题讨论】:
标签: class blackberry