0

The webview of my app won't store cookie so that I have login again if I restart my app.

To store cookie, what should I add to this codes?
Can anyone show me with code using my original code?

public class MainActivity extends Activity {

    private ActionBar mActionBar;
    private SimpleSideDrawer mNav;
    WebView myWebView;  

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        myWebView = (WebView)findViewById(R.id.webView1);
        myWebView.setWebViewClient(new WebViewClient());
        myWebView.getSettings().setJavaScriptEnabled(true);
        myWebView.loadUrl("http://example-site.com");          
        myWebView.getSettings().setSupportZoom(true); 
        myWebView.getSettings().setLoadWithOverviewMode(true);
        myWebView.getSettings().setUseWideViewPort(true); 
    .....
    }
....
}
4

1 回答 1

2

您可以存储 cookie 并在应用程序启动时检索它们,就像在这里解释 Android WebView Cookie Problem

于 2013-08-14T09:27:53.287 回答