Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/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会导致无限循环_Android_Android Intent - Fatal编程技术网

Android-在外部浏览器中打开url会导致无限循环

Android-在外部浏览器中打开url会导致无限循环,android,android-intent,Android,Android Intent,默认情况下,我的应用程序可以使用以下方法打开链接: <category android:name="android.intent.category.BROWSABLE" /> <data android:host="example.com" android:scheme="http" /> <data android:host="www.example.com" android:

默认情况下,我的应用程序可以使用以下方法打开链接:

<category android:name="android.intent.category.BROWSABLE" />
    <data
        android:host="example.com"    
        android:scheme="http" />
    <data
        android:host="www.example.com"
        android:scheme="http" />
             ....
我所期望的是,它将在浏览器上打开,但如果用户选择默认情况下应用程序将打开所有链接(“始终打开”而不是“仅打开一次”),应用程序将再次调用并再次将链接发送到浏览器-这会导致无限循环。 如何避免这种情况?


你试过使用像google.com之类的有效网站吗?是的。我用正确的URL尝试了它,你直接把它放在我的应用程序中,例如我不在mi XML
startActivity中创建“数据”(new Intent(Intent.ACTION\u VIEW,Uri.parse(“www.google.es”))
String requestURL = "www.example.com/unsupportedlink";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(requestURL));
mActivity.startActivity(i);
Uri uri = Uri.parse(requestURL);
Intent browserIntent = new Intent(Intent.ACTION_VIEW);
browserIntent.setDataAndType(uri, "text/html");
browserIntent.addCategory(Intent.CATEGORY_BROWSABLE);
context.startActivity(browserIntent);