I'm trying to make my very firs j2me program, so please bear with me...
My question: how can I pass a value of string variable to "commandAction"? I mean something like this:
public void test() {
String myVariable = "hello";
option1 = new Command("Option 1", Command.EXIT, 2);
textBox.addCommand(option1);
textBox.setCommandListener(this);
Display.getDisplay(this).setCurrent(textBox);
}
public void commandAction(Command cmd, Displayable displayable) {
if (cmd == option1) {
print myVariable; // HOW TO MAKE THIS WORK?
}
How can I pass value of "myVariable" from "test" to "commandAction"? Does j2me have some "global variables" or how can I do this?