0

I am trying to load an animated html file to draw arc and line. Please let me know how to enable javascript in android studio. Button click it should call the html file to draw arc or line. But it is simply viewing like text, Its not drawing. Please tell me how to call html canvas files in android studio.

I tried the following code to load my html file

   `WebView wv=(WebView) findViewById(R.id.mybrowser1);
    wv.getSettings().setPluginsEnabled(true);
    WebSettings webSettings = wv.getSettings();
    webSettings.setJavaScriptEnabled(true);`

But in android studio it is showing like cannot resolve method setPluginsEnabled(boolean).

tom cat
  • 1
  • 4
  • check this http://stackoverflow.com/questions/19362049/setpluginsenabled-not-exist-for-webview – Emil Aug 21 '15 at 06:25
  • I checked that link also. And i tried using WebView.getSettings().setPluginState(WebSettings.PluginState.ON); It is showing **This Inspection reports where deprecate code is used in the specified inspection scope** – tom cat Aug 21 '15 at 06:30

2 Answers2

1
webView.getSettings().setJavaScriptEnabled(true);

Tells the WebView to enable JavaScript execution. The default is false.

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
0
 WebView myWebView = (WebView) findViewById(R.id.webview1);
    myWebView.getSettings().setBuiltInZoomControls(false);
    myWebView.setVerticalScrollBarEnabled(false);
    myWebView.clearCache(true);
    myWebView.setFocusable(true);
    myWebView.setHorizontalScrollBarEnabled(false);
    myWebView.getSettings().setPluginState(PluginState.ON);
    myWebView.getSettings().setJavaScriptEnabled(true);
    myWebView.getSettings().setAppCacheEnabled(true);
    myWebView.getSettings().setRenderPriority(RenderPriority.HIGH);
    myWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    myWebView.getSettings().setAllowFileAccess(true);
    myWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    myWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);

enter link description here

see this link

Community
  • 1
  • 1
Amit Basliyal
  • 840
  • 1
  • 10
  • 28
  • Thanks amit. This is not showing any errors. Still the animation is not running. If possible can u post some sample code which works fine. – tom cat Aug 21 '15 at 06:47
  • see this all full code http://techminders.blogspot.in/2015/07/webview-for-beginner-in-android-with.html – Amit Basliyal Aug 21 '15 at 07:11
  • Is the above code is just to call webpage? I am trying to draw a line by giving points. Starting point and ending point, I am trying to draw a line by giving these two points using html. I want to call the following like html file http://jsfiddle.net/UtmTh/ – tom cat Aug 21 '15 at 07:29