How to return String in anonymous class for a method returning void
<p>I'm bit confused. I have the following:</p>

<pre><code>public static String showInputDialog() {
   Form frm = new Form();
   final Command cmd = new Command("Ok");
   final TextField txt = new TextField("Enter the text", null, 1024, 0);
   frm.addCommand(cmd);
   frm.append(txt);
   frm.setCommandListener(new CommandListener() {

       public void commandAction(Command c, Displayable d) {
            if (c == cmd) {
                return txt.getString(); // Error !!
            } else {
                return null; // Error !!
            }
       }
   });
}
</code></pre>

<p>As you can see, I want to return the input dialog string, while the anonymous class method should return void. How can I resolve this problem?</p>
