Hi,

because I cannot access a variable in the enclosing block from within
an AsyncCallback method I found the following workaround with a class
global variable, which I find very unpretty. How can one do this
better?

String tmp_str_usr = "";

 String getUser ()
 {
  SystemServiceAsync svc = GWT.create (SystemService.class);

  svc.getUsr
  (
   new AsyncCallback<String>()
   {
    public void onFailure(Throwable caught)
    {
     Window.alert("server side failure: " + caught);
    }

    public void onSuccess(String usr)
    {
     tmp_str_usr = usr;
    }
   }
  );

  return (tmp_str_usr);
 }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to