Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/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中打开URL';从我的应用程序中删除web浏览器?_Android - Fatal编程技术网

在Android中打开URL';从我的应用程序中删除web浏览器?

在Android中打开URL';从我的应用程序中删除web浏览器?,android,Android,从我的应用程序在Android的web浏览器中打开URL? 我试过这个: try { Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(download_link)); startActivity(myIntent); } catch (ActivityNotFoundException e) { Toast.makeText(this, "No application

从我的应用程序在Android的web浏览器中打开URL? 我试过这个:

 try {
        Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(download_link));
        startActivity(myIntent);
    } catch (ActivityNotFoundException e) {
        Toast.makeText(this, "No application can handle this request."
            + " Please install a webbrowser",  Toast.LENGTH_LONG).show();
        e.printStackTrace();
    }

您应该检查链接,否则必须显示日志。

您可以尝试以下操作:

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

public void onOpenWebBrowser(View v)
{
   Intent webPageIntent = new Intent(Intent.ACTION_VIEW);
   webPageIntent.setData(Uri.parse("https://www.google.co.in/"));

   try {
      startActivity(webPageIntent);
   } catch (ActivityNotFoundException ex) {

   }
}

你面临的问题是什么?你的logcat怎么说??
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

public void onOpenWebBrowser(View v)
{
   Intent webPageIntent = new Intent(Intent.ACTION_VIEW);
   webPageIntent.setData(Uri.parse("https://www.google.co.in/"));

   try {
      startActivity(webPageIntent);
   } catch (ActivityNotFoundException ex) {

   }
}