It can be done, but in a tricky way.
You can create a little html file with an auto submit form, read it into a string, replace params and embed it in the intent as a data uri instead of a url.
There are a couple little negative things, it only works calling default browser directly, and trick will be stored in browser history, it will appear if you navigate back.
Here is an example:
HTML file (/res/raw):
Source code:
private void browserPOST() {
Intent i = new Intent();
// MUST instantiate android browser, otherwise it won't work (it won't find an activity to satisfy intent)
i.setComponent(new ComponentName("com.android.browser", "com.android.browser.BrowserActivity"));
i.setAction(Intent.ACTION_VIEW);
String html = readTrimRawTextFile(this, R.raw.htmlfile);
// Replace params (if any replacement needed)
// May work without url encoding, but I think is advisable
// URLEncoder.encode replace space with "+", must replace again with %20
String dataUri = "data:text/html," + URLEncoder.encode(html).replaceAll("\\+","%20");
i.setData(Uri.parse(dataUri));
startActivity(i);
}
private static String readTrimRawTextFile(Context ctx, int resId) {
InputStream inputStream = ctx.getResources().openRawResource(resId);
InputStreamReader inputreader = new InputStreamReader(inputStream);
BufferedReader buffreader = new BufferedReader(inputreader);
String line;
StringBuilder text = new StringBuilder();
try {
while ((line = buffreader.readLine()) != null) {
text.append(line.trim());
}
}
catch (IOException e) {
return null;
}
return text.toString();
}