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); 
    .....
    }
....
}
Termininja
  • 6,620
  • 12
  • 48
  • 49
MKK
  • 2,713
  • 5
  • 31
  • 51

1 Answers1

2

you can store the cookie and retrieve them on app start like expline here Android WebView Cookie Problem

Community
  • 1
  • 1
  • Could you show me how with my code? I'm sorry. I'm new to android so that I want to know how it goes on my code – MKK Aug 14 '13 at 10:02
  • the first answer in the http://stackoverflow.com/questions/1652850/android-webview-cookie-problem can resolve your problem – Bouchehboun Saad Aug 14 '13 at 17:22