tptee / OpenFLWebView

Native extension for WebViews in iOS and Android, updated to work with OpenFL
11 stars 0 forks source link

Android webview #2

Open mrioux007 opened 10 years ago

mrioux007 commented 10 years ago

Work on ios but not on android.

It will work if you change the package for import org.haxe.lime.GameActivity; import org.haxe.lime.HaxeObject;

in NMEWebView.java

and

change line 26 to 28 for

if android

if (APIInit == null) APIInit = openfl.utils.JNI.createStaticMethod("com.arcademonk.haxe.NMEWebView", "APIInit", "(Lorg/haxe/lime/HaxeObject;Z)V"); if (APINavigate == null) APINavigate = openfl.utils.JNI.createStaticMethod("com.arcademonk.haxe.NMEWebView", "APINavigate", "(Ljava/lang/String;)V"); if (APIDestroy == null) APIDestroy = openfl.utils.JNI.createStaticMethod("com.arcademonk.haxe.NMEWebView", "APIDestroy", "()V");

RafaelOliveira commented 10 years ago

To me, I needed the things above, plus these changes in the lines 45 to 47 in WebView.hx (remove the nme reference):

if (method == "init") Lib.postUICallback(function() { APIInit(args[0], args[1] == true); }); if (method == "navigate") Lib.postUICallback(function() { APINavigate(args[0]); }); if (method == "destroy") Lib.postUICallback(function() { APIDestroy(); });