gwt - JSNI - invoking native method from another native method -


how call native on button click of native method? can call more 1 native method single native method on button click

yes can it.

sample code:

public void onmoduleload() {     exportsayhello();      button btn = new button("click");     btn.addclickhandler(new clickhandler() {          @override         public void onclick(clickevent event) {             buttonclicked("vartika");         }     });      rootpanel.get().add(btn); }  public static native void exportsayhello() /*-{     $wnd.sayhellofunction = $entry(@com.gwt.test.client.gwttestproject::sayhello(ljava/lang/string;)); }-*/;  public static native void buttonclicked(string value)/*-{     $wnd.sayhellofunction(value); }-*/;  public static native void sayhello(string value)/*-{     $wnd.alert("hello " + value); }-*/; 

steps follow:

  • export method sayhello() javascript using jsni
  • now call native method buttonclicked() using same name sayhellofunction exported javascript.

read more gwt jsni.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -