安卓:转到HTTP URL上的按钮单击 [英] Android: Goto HTTP Url on Button Click

查看:134
本文介绍了安卓:转到HTTP URL上的按钮单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要到网页上的一个按钮,在我的Andr​​oid应用程序的点击。所以说,我有一个名为谷歌按钮,当用户点击该按钮我想google.com开拓屏幕上。这是如何实现的?

I want to go to a web page on the click of a button in my Android app. So say, I have a button called "Google", when the user clicks on that button I want google.com to open up on the screen. How is this achieved?

此外,有没有一种方法,我能获得控制权返回给我的应用程序,一旦用户完成与谷歌?

Also, is there a way I can gain control back to my app once the user is finished with Google?

推荐答案

在你的活动做这样的事情。

In your activity do something like this.

public void openWebURL( String inURL ) {
    Intent browse = new Intent( Intent.ACTION_VIEW , Uri.parse( inURL ) );

    startActivity( browse );
}

在默认情况下,退出浏览器应该返回到你的活动。然而,可能存在的情况下也不会

By default, quitting the browser should return to your activity. However, there may be situations where it will not.

这篇关于安卓:转到HTTP URL上的按钮单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆