Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.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_Intentfilter - Fatal编程技术网

android:如何读取额外的数据

android:如何读取额外的数据,android,intentfilter,Android,Intentfilter,我需要(如果可能的话)处理这样的“url”(在电子邮件中,我需要打开我的应用程序(“wics”): 我的AndroidManifest.xml中有这个 <activity android:name=".ResetPasswordActivity"> android:label="@string/app_name"> <intent-filter> <action android:n

我需要(如果可能的话)处理这样的“url”(在电子邮件中,我需要打开我的应用程序(“wics”):

我的AndroidManifest.xml中有这个

<activity android:name=".ResetPasswordActivity">
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="http"
                    android:host="wics"/>
            </intent-filter>   
</activity>

但是现在呢?拆分“uri”字符串并获得3td和4th元素?

您可以这样做

<meta-data android:name="my_url" android:value="http://wics/resetPassword/myemail@mydomain.ext/FOOBARTOKEN" />
然后在“/”分隔符上拆分

String[] arr =  url.split("/");
然后你需要做的就是在arr上循环并找到你的单词。
有什么意义吗?

请按照接受的答案回答。谢谢。总是愿意分享知识。谢谢@Caspain。我曾做过类似的事情,但我认为这不是正确的方法。再次感谢。
<meta-data android:name="my_url" android:value="http://wics/resetPassword/myemail@mydomain.ext/FOOBARTOKEN" />
ApplicationInfo appInfo = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA);
Bundle bundle = appInfo.metaData;

String url = bundle.getString("my_url");
Uri uri = Uri.parse(url);
String[] arr =  url.split("/");