Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/217.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/5/fortran/2.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
Android 安卓如何通过点击按钮浏览网站_Android_Android Intent_Android Button - Fatal编程技术网

Android 安卓如何通过点击按钮浏览网站

Android 安卓如何通过点击按钮浏览网站,android,android-intent,android-button,Android,Android Intent,Android Button,当我点击adroid应用程序中的按钮时,我想导航到facebook粉丝页面。 我是android新手。有谁能帮我做这件事。你为什么不试一下呢 String url = "http://www.facebook.com/yourfanpagename"; Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); 将上面的代码放在您的按钮单击中。为什么不这样尝试呢 String u

当我点击adroid应用程序中的按钮时,我想导航到facebook粉丝页面。
我是android新手。有谁能帮我做这件事。

你为什么不试一下呢

String url = "http://www.facebook.com/yourfanpagename";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);

将上面的代码放在您的按钮单击中。

为什么不这样尝试呢

String url = "http://www.facebook.com/yourfanpagename";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
将上面的代码放在您的按钮单击中。

只需使用意图即可。 举个例子,

在按钮的单击事件中:

// Open Website
    Intent intent;

    try {
        intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.facebook.com/yourPage"));
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
    } catch (Exception e) {
        Log.e("Exception Caught", e.toString());
    }
希望这有帮助

只需使用意图即可。 举个例子,

在按钮的单击事件中:

// Open Website
    Intent intent;

    try {
        intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.facebook.com/yourPage"));
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
    } catch (Exception e) {
        Log.e("Exception Caught", e.toString());
    }

希望这有帮助

您可以通过两种方式完成:

  • 使用intent打开浏览器,如下所示:

    String url = "http://www.facebook.com/your_page";
    Intent i = new Intent(Intent.ACTION_VIEW);
    
    i.setData(Uri.parse(url));
    startActivity(i);
    
  • 在布局中使用webview,并在应用程序中打开链接。这更可取


  • 您可以找到实现它的链接。

    您可以通过两种方式实现:

  • 使用intent打开浏览器,如下所示:

    String url = "http://www.facebook.com/your_page";
    Intent i = new Intent(Intent.ACTION_VIEW);
    
    i.setData(Uri.parse(url));
    startActivity(i);
    
  • 在布局中使用webview,并在应用程序中打开链接。这更可取


  • 您可以找到实现它的链接。

    可能重复的您尝试过任何答案吗?可能重复的您尝试过任何答案吗?