webview.loadurl() Vs super.loadurl() in android phonegap

Rohit picture Rohit · Dec 4, 2013 · Viewed 8.3k times · Source

What is the difference b/w these two methods

webView.loadUrl("file:///android_asset/www/index.html");

and super.loadUrl("file:///android_asset/www/index.html");

When i am using second one my application running well but when i am using first one it looks either blank or in some cases a alert dialog appear said about plugins...

I want to make application on Phonegap, I exactly want to know that which one is better approach for it.

When i am using webview.loadurl() and call addJavascriptInterface(), In that case the functions are written into the HTML file under the <script> tag are not invoke on click of any button(defined in HTML),

Please help me, i am stuck, Thanks in advance...

Answer

Praveen Sharma picture Praveen Sharma · Dec 4, 2013

In your Phonegap project the Main Activity .java class contains extends DroidGap

so in this case

super.loadUrl("file:///android_asset/www/index.html");

is useful because Webview of DroidGap capture this url.

And in your Android app your activity .java class contains extends Activity so

webView.loadUrl("file:///android_asset/www/index.html");

The Webview specified by you in your activity class will capture the Url .