0

WebViewPage.java

   package com.srccodes.androidprojects;
   import android.os.Bundle;
   import android.annotation.SuppressLint;
   import android.app.Activity;
   import android.view.Menu;
   import android.webkit.WebChromeClient;
   import android.webkit.WebSettings.PluginState;
   import android.webkit.WebView;
   import android.webkit.WebViewClient;

 //*******************************************************************************

      public class WebViewPage extends Activity {

      // *******************************************************************************

private WebView webView;

// *******************************************************************************

@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_web_view_page);
    webView = (WebView) findViewById(R.id.webView1);

// ******************************************************************************

webView.setWebViewClient(new WebViewClient());  
  webView.getSettings().setJavaScriptEnabled(true);                                     
    webView.getSettings().setPluginState(PluginState.ON);           
    webView.getSettings().setLoadsImagesAutomatically(true); 
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);       
    webView .setKeepScreenOn(true);         
    webView .setInitialScale(100);      
    webView .getSettings().setUseWideViewPort(true);          
    webView .setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);     
    webView.getSettings().setBuiltInZoomControls(true);     
    webView.setWebChromeClient(new WebChromeClient());               
    webView.getSettings().setDomStorageEnabled(true);           
    webView.loadUrl("http://192.168.2.15:8090/ICUAlerts/jsp/Index/index.jsp");    
}

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.activity_web_view_page, menu);
    return true;
}
}

This is my code for hiding address bar in android..

I Login my page in one orientation after changing this orientation(either vertical or horizontal) it may signout why?Please edit this code...

I used a javascript calendar in application If without webView.setWebViewClient(new WebViewClient()); Javascript calendar working but using this webviewclient it doesn't work

And my layout file is

<WebView  

xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
user2493093
  • 31
  • 1
  • 4
  • 6

1 Answers1

0

I think the logout is because your change in orientation reloads the activity, and from start you are not logged in. Try this :

Android WebView: handling orientation changes

Community
  • 1
  • 1