Hello!
I have a problem. I am calling to server side on GWT. The results of
call is an ArrayList (result). Inside onSuccess method another
ArrayList is wrapped with the result. However, if I want to use
ArrayList lista outside of onSuccess method it contains 0 elements,
but inside is like result ArrayList. How can I solve it? I have tried
to use lista as class attribute, static attribute,... but it doesn't
run.
Thanks!

public void addContainers() throws Exception {
                final ArrayList<String> lista = new ArrayList<String>();
                gwtService.obtainAttributesDevice(1, new
AsyncCallback<ArrayList<String>>(){
                        @Override
                        public void onFailure(Throwable caught) {
                                System.out.println("ERROR");
                                Window.alert(caught.getMessage());
                        }
                        @Override
                        public void onSuccess(ArrayList<String> result) {
                                RootPanel.get("mainContainer").add(new 
Label("Array result:
"+result.toString()));
                                RootPanel.get().add(new 
Label(String.valueOf("Array result:
"+result.size())));
                                lista.addAll(0, result);
                                RootPanel.get("mainContainer").add(new 
Label("Array lista 1:
"+lista.toString()));
                                RootPanel.get().add(new 
Label(String.valueOf("Array lista 1:
"+lista.size())));
                        }
                });
                RootPanel.get("mainContainer").add(new Label("Array lista 2:
"+lista.toString()));
                RootPanel.get().add(new Label(String.valueOf("Array lista 2:
"+lista.size())));
                for(int i = 0; i < lista.size(); i++){
                        RootPanel.get().add(new Label("BOTON "+i));
                }
}

-- 
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