【问题标题】:How to open an external browser using Intent.ACTION_VIEW and passing parameters to post?如何使用 Intent.ACTION_VIEW 打开外部浏览器并将参数传递给 post?
【发布时间】:2015-12-28 11:04:54
【问题描述】:

我无法通过邮寄方式发送数据来打开浏览器。使用 HTML 表单如下:

<form method='post' action='https://cieloecommerce.cielo.com.br/transactional/order/buynow' target='blank'>
<input type='hidden' name='id' value=xyz-xyz-xyz-xyz-xyz'
/>
<input type='image' name='submit' alt='Comprar' src='{Button Image}'>
</form>

但是,当我在 Android 浏览器中拨打电话时,Intent 会打开一个错误页面。 我喜欢这个:

private String idCielo;

[...]

@Override
                    public void onClick(View view) {
                        Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://cieloecommerce.cielo.com.br/transactional/order/buynow"+idCielo));
                            getActivity().startActivity(browserIntent);

                    }

@Override
                    public void onClick(View view) {
                        Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://cieloecommerce.cielo.com.br/transactional/order/buynow”));
                       browserIntent.putExtra("id",idCielo); 

                            getActivity().startActivity(browserIntent);

                    }

请帮帮我。我必须传递值才能在外部浏览器中发布和打开页面。 谢谢!

【问题讨论】:

标签: android post android-intent browser


【解决方案1】:

只需调用 ACTION.VIEW 意图并为其设置 数据源

 Intent i = new Intent(Intent.ACTION_VIEW);
 i.setData(Uri.parse("http://www.StackOverFlow.com"));
 startActivity(i);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-05-22
    • 1970-01-01
    • 2014-01-09
    • 2020-04-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-24
    • 1970-01-01
    相关资源
    最近更新 更多