I’m coming from Android and now I’m learning for Blackberry.
In Android to access other class we can pass it’s context similar “this” in java. How to do it in Blackberry? The problem is in Blackberry I would like to add a field/manager of Screen class in other class, example of the code:
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 in other file class
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
}
}
Change the process1 constructor to take a MyScreen object: