How can I open Android browser with specified POST parameters?

Ungureanu Liviu picture Ungureanu Liviu · Nov 7, 2010 · Viewed 17.5k times · Source

I my application, I need to open a link in Android Browser. This page can receive some data just via POST. Could I add these parameters (data) to the intent which start the browser?

Do you know if this is possible? If it is, could you give my a hint?

Answer

Pete picture Pete · Apr 4, 2011

Use a webview:

WebView webview = new WebView(this);
setContentView(webview);
byte[] post = EncodingUtils.getBytes("postvariable=value&nextvar=value2", "BASE64");
webview.postUrl("http://www.geenie.nl/AnHeli/mobile/ranking/demo/index.php", post);