Java 用android参数打开url

Java 用android参数打开url,java,android,paypal,Java,Android,Paypal,你好,我想打开一个PayPal uri从android支付 我想打开web uri并添加parmas。 我该怎么做 有这样的意图 Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.paypal.com/cgi-bin/webscr")); browserIntent.putExtra("param1","param1");

你好,我想打开一个PayPal uri从android支付

我想打开web uri并添加parmas。 我该怎么做

有这样的意图

            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.paypal.com/cgi-bin/webscr"));
            browserIntent.putExtra("param1","param1");
                            browserIntent.putExtra("param2","param2");
                            browserIntent.putExtra("param3","param3");
            startActivity(browserIntent);

你可以这样做

String params = URLEncoder.encode("param1=param1&param2=param2&param3=param3", "utf-8");
String url = "https://www.paypal.com/cgi-bin/webscr?" + params;

Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(browserIntent);

在Android上使用PayPal支付的更简单方法是使用本机

Bishan的解决方案不适用于我=并且&编码错误

这是一种使用参数对URL进行编码的方法:

Uri authUri = Uri.parse("https://www.paypal.com/cgi-bin/webscr")
                .buildUpon()
                .appendQueryParameter("param1", "value1")
                .appendQueryParameter("param2", "value2")
                .appendQueryParameter("param3", "value3")
                .build();

你是在问如何转义和连接查询字符串吗?我想要的是将数据发送到url,然后根据参数打开它。在安卓网络浏览器的屏幕上添加用户信息,比如信用卡之类的that@user3170439很高兴能帮助您: