her's my problem: JsArray<OverlayData> db = new Datenbank<OverlayData>("data.php"); if(db.getData() == null) System.err.println("getData() is null!");
and everytime i get: getData() is null! her's my class: public class Datenbank<T extends JavaScriptObject> { private String phpURL = null; private RequestBuilder requestBuilder = null; private JsArray<T> dataArray = null; public Datenbank(String phpFile) { phpURL = GWT.getModuleBaseURL() + "../" + phpFile; requestBuilder = new RequestBuilder(RequestBuilder.GET, phpURL); request(); } public JsArray<T> getData() { return dataArray; } private final native JsArray<T> asArrayOfData(String json) /*-{ return eval(json); }-*/; private void request() { try { requestBuilder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { message.reportError("Couldn't retrieve JSON"); } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) dataArray = asArrayOfData(response.getText()); } }); } catch (RequestException e) { message.reportError("Couldn't retrieve JSON"); } } } need help :( On 19 Jun., 09:20, daim <robin....@googlemail.com> wrote: > hi, > > im trying to set the membervariabledataArray with the eval(json) > result, but dataArray stays always null :( > > //here is my membervariable > private JsArray<T> dataArray = null; > > //here is thenativemethod > private finalnativevoid asArrayOfData(String json) > /*-{ > th...@de.rob1n.gruen.client.datenbank::dataArray = eval > (json); > > }-*/; > > how to do that?! > > thanks --~--~---------~--~----~------------~-------~--~----~ 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-Toolkit@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 -~----------~----~----~----~------~----~------~--~---