It already is.
I have a code like this:
Request request = builder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
                       // Couldn't connect to server (could be timeout, SOP
violation, etc.)
                    }
                    @Override
                        public void onResponseReceived(Request request, 
Response response)
{
}

In onResponseReceived I parse JSON which I received and populate a
variable which is member of class and call another method, for
populate some table. Another method get the variable (which I
populated) - but it is empty until I call Window.alert("anything").
After alert the variable is populated.

On Dec 27, 3:49 pm, Ian Bambury <[email protected]> wrote:
> You can't fire off an async request to the server and expect to be able to
> use the result immediately.
>
> Move the code you have after the RPC or RequestBuilder call into the
> onSuccess method of the callback.
>
> Ian
>
> http://examples.roughian.com
>
> 2009/12/25 MaEcTPo <[email protected]>
>
>
>
> > I have a problem.
>
> > I have a variable on my class:
> > public ArrayList<HashMap<String,String>> statuses = new
> > ArrayList<HashMap<String,String>>();
> > and I have a method, which populates this variable from JSON.
>
> > So, after populating I try to use it, but it is empty. But, If I use
> > Window.alert("something") before, I'll receive in this variable what I
> > want.
>
> > For example, this part of code write to GWT.log:
>
> > int statusesSize = statuses.size();
> > GWT.log("statusesSize: " + statusesSize, null);
> > Window.alert("" + statusesSize);
> > int statusesSize2 = statuses.size();
> > GWT.log("statusesSize2: " + statusesSize2, null);
>
> > 12:58:25.541 [INFO] [mythirdgwt2] statusesSize: 0
> > 12:58:49.864 [INFO] [mythirdgwt2] statusesSize2: 4
>
> > Why it happens? How can I fix it?
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-web-toolkit%2Bunsubs 
> > [email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.

--

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


Reply via email to