简体   繁体   English

有没有办法从Android中的网络浏览器获取信息?

[英]Is there a way to get information from the web browser in Android?

I would like to create a charity application where if the users were to press the 'Donate' button, their browser would open up a link to a 3rd-party crowdfunding website where they would donate some amount for that project (or choose to exit the app or whatever!). 我想创建一个慈善应用程序,如果用户按下“捐赠”按钮,他们的浏览器将打开一个指向第三方众筹网站的链接,在该网站上,他们将为该项目捐款(或选择退出应用程序或其他!)。 How do I get to know what amount they have donated (or not!) from the browser so that this data can be used for that member's stats, etc. 我如何知道他们从浏览器中捐赠了(或不捐赠!)多少,以便这些数据可用于该会员的统计信息,等等。

Yes it is possible. 对的,这是可能的。 You can use webView 您可以使用webView

 Button button = (Button) findViewById(R.id.b);
 button.setOnClickListener(new View.OnClickLister()
 @overide
 public void onClick(View v) {
WebView mWebView=(WebView)_findViewById(R.id.webView);
mWebview .loadUrl("url for third party app");
        setContentView(mWebview );
});

or you can use intent 或者你可以使用意图

Button button = (Button) findViewById(R.id.b);
 button.setOnClickListener(new View.OnClickLister()
 @overide
 public void onClick(View v) {
WString url = "http://www.example.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM