Wouldn’t a call to commandAction on result in a direct call to
public void commandAction(Command c, Displayable s)
on the GameCanvas.
If this is true then I see two problems:
1) I want to invoke the commandAction from my game loop thread. This means that the commandAction is not called from the main midlet thread as usual but from my custom thread instead. Would this potentionally give some problems?
2) It is not the GameCanvas that set as the commandListener in my situation. Instead it is a control class that handles all the events. So if I call GameCanvas.commandAction directly the control class will not receive the events.
Are the two problems that I described above legitimate?
Isn't it possible to invoke the command from code so it is invoked by the framework the same way as other commands?
1) Could be a problem if the command takes a while to be processed - it will stall your game loop. But you can just make a small thread and call it from there. Another option is to use Display.callSerially() if you want it on the main event thread.
2) Just call the commandAction from your control class or wherever you implement it.