I'm working in java me, I'm trying to switch between visual designs using ok Commands and back Commands. I have a form displayable which I named formA in my main class A.java and a formB in another class B.java. I used an ok Command in formA which on selection, is supposed to take the user to formB. At first when I tried to call the getFormB method from my main class, it didn't work(non-static method cannot be referenced from a static context).
I was adviced to create a reference to B.java so I added this line in my main class A.java
B b = new B(this);
now I could call the getFormB method from my commandAction in formA. At this point, everything worked well but when I tried to add a backCommand which is supposed to take me back to formA in A.java I get ds error again 'non-static method getFormA() cannot be referenced from a static context', so I tried creating a reference in B.java same way I did in A.java, here's the code:
A a = new A();
then in command action I did ds on the backCommand:
switchDisplayable(null, a.getFormA());
This time, it compiled without errors. But at runtime I get a SecurityException MIDlet Manager ERROR:
Illegal attempt to construct hello.A@e938beb1
'hello' is the package containing both java files.
Can anyone help me out?