android实现按钮跳转到指定网页

 时间:2026-02-14 11:09:00

1、构造一个按钮,

 Button rdcy=(Button)findViewById(R.id.rdcy);

        rdcy.setOnClickListener(new View.OnClickListener() {

            @Override

            public void onClick(View v) {

                Uri uri = Uri.parse("http://baike.baidu.com/view/753813.htm");

                Intent intent = new Intent(Intent.ACTION_VIEW, uri);

                startActivity(intent);

            }

        });

2、按钮的代码添加在protected void onCreate(Bundle savedInstanceState){}

方法里。

3、Uri uri = Uri.parse("http://baike.baidu.com/view/753813.htm");

                Intent intent = new Intent(Intent.ACTION_VIEW, uri);

"http://baike.baidu.com/view/753813.htm"为你要转到的网站。

  • php+mysql怎样一次插入多条记录到数据库
  • IDEA代理抛出异常:1099端口占用
  • 如何用PHP往MySQL中插入数据
  • Power Designer做出完整逻辑图
  • IntelliJ IDEA怎么设置打开软件自动打开项目
  • 热门搜索
    传染病手抄报 红军长征手抄报 关于曹文轩的手抄报 关于科学家的手抄报 只要妈妈露笑脸手抄报 以爱为主题的手抄报 交通安全小报手抄报 防火防电手抄报 好人好事手抄报 消防安全手抄报知识