方法/步骤
-
构造一个按钮,
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);
}
});
-
按钮的代码添加在protected void onCreate(Bundle savedInstanceState){}
方法里。
-
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"为你要转到的网站。