Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在eclipse for android中制作一个用作链接的按钮_Java_Android_Xml_Eclipse - Fatal编程技术网

Java 如何在eclipse for android中制作一个用作链接的按钮

Java 如何在eclipse for android中制作一个用作链接的按钮,java,android,xml,eclipse,Java,Android,Xml,Eclipse,我需要知道如何制作一个打开androids web浏览器并导航到特定URL的按钮。我正在使用eclipse,并且已经知道如何制作按钮和单击侦听器。 谢谢您的帮助。只需将此代码添加到onClick(): Intent websiteIntent = new Intent(Intent.ACTION_VIEW); Uri uri = Uri.parse("http://www.android.com"); websiteIntent.setData(uri); startActivity(websi

我需要知道如何制作一个打开androids web浏览器并导航到特定URL的按钮。我正在使用eclipse,并且已经知道如何制作按钮和单击侦听器。
谢谢您的帮助。

只需将此代码添加到onClick():

Intent websiteIntent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.parse("http://www.android.com");
websiteIntent.setData(uri);
startActivity(websiteIntent);
试试这个

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com");
startActivity(intent);  
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com");
startActivity(intent);