title: Turn javascript on in android webview
body: <p>hello i am new to android developing,</p>
  
  <p>I want to set my javscript turn on in my android webview. I tried everything, but it doesn't work. My code below is my webview class. I hope someone can help me.</p>
  
  <pre><code>package visuals.Webview;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.graphics.Bitmap;
  import android.net.Uri;
  import android.os.Bundle;
  import android.view.KeyEvent;
  import android.webkit.WebView;
  import android.webkit.WebViewClient;
  
  public class VisualsActivity extends Activity {
  /** Called when the activity is first created. */
  
  final Activity activity = this;
  WebView webview;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      webview = (WebView) findViewById(R.id.webview);
     // webview.setWebViewClient(new myWebClient());
  
      webview.loadUrl("http://192.168.0.62/lastversion/index.php");
      webview.getSettings().setJavaScriptEnabled(true);
      webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
      webview.getSettings().setUserAgentString(getString(R.string.user_agent_suffix));   
  }
  
  public class myWebClient extends WebViewClient
  {
      @Override
      public void onPageStarted(WebView view, String url, Bitmap favicon) {
          // TODO Auto-generated method stub
          super.onPageStarted(view, url, favicon);
      }
  
      @Override
      public boolean shouldOverrideUrlLoading(WebView view, String url) { 
          if (url.startsWith("tel:")) { 
              startActivity(new Intent(Intent.ACTION_DIAL, Uri.parse(url))); 
              return true; 
          } else if (url.startsWith("mailto:")) { 
              url = url.replaceFirst("mailto:", ""); 
              url = url.trim(); 
              Intent i = new Intent(Intent.ACTION_SEND); 
              i.setType("plain/text").putExtra(Intent.EXTRA_EMAIL, new String[]{url}); 
              startActivity(i); 
              return true; 
          } else { 
              view.loadUrl(url); 
              return true; 
          } 
      } 
  }
  
  // To handle "Back" key press event for WebView to go back to previous screen.
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) 
  {
      if ((keyCode == KeyEvent.KEYCODE_BACK) &amp;&amp; webview.canGoBack()) {
          webview.goBack();
          return true;
      }
      return super.onKeyDown(keyCode, event);
  }
   }
  </code></pre>
  
  <p>Thank you for helping</p>