Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Does anyone know how to pass value in webview using post method?

engine = (WebView) findViewById(R.id.web_engine);

engine.setWebViewClient(new WebViewClient() {

    @Override
    public void onPageFinished(WebView view, String url) {
        super.onPageFinished(view, url);
    }

    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
        super.onPageStarted(view, url, favicon);
    }

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        return super.shouldOverrideUrlLoading(view, url);
    }
});

engine.getSettings().setJavaScriptEnabled(true);
engine.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
engine.loadUrl(url+"?ref=api&uname="+id+"&pass="+pass);

This is the way I am sending the data using get method, I want to use Post method.

share|improve this question
    
are you want to call webservice? –  Sanket Kachhela Nov 2 '12 at 8:00

3 Answers 3

Try this

String url = "http://www.example.com";
String postData = "username=my_username&password=my_password";
webview.postUrl(url,EncodingUtils.getBytes(postData, "BASE64"));
share|improve this answer

Use postUrl to use POST in WebView.

share|improve this answer

Use postUrl Method for post dat. More detail Follow This.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.