Android 这是比较意图的正确方法吗?

Android 这是比较意图的正确方法吗?,android,Android,比较意图是否正确?无论传入的Intent是android.Intent.action.VIEW(Intent.getAction()值返回),我都不会进入if/else: 更新:为什么intent.getAction()返回android.intent.action.VIEW(大写字母“i”),而它应该返回android.intent.action.VIEW,如中所示?我找到了大写字母“i”的来源。只要我在使用SearchView我就指定了当新的活动将由我自己启动时要使用的Intent,所以我在

比较
意图是否正确?无论传入的
Intent
android.Intent.action.VIEW
(Intent.getAction()值返回),我都不会进入if/else:


更新:为什么
intent.getAction()
返回
android.intent.action.VIEW
(大写字母“i”),而它应该返回
android.intent.action.VIEW
,如中所示?

我找到了大写字母“i”的来源。只要我在使用
SearchView
我就指定了当新的
活动
将由我自己启动时要使用的
Intent
,所以我在这里犯了一个错误:

<searchable xmlns:android="http://schemas.android.com/apk/res/android"
            android:label="@string/appname"
            android:hint="@string/search_hint"
            android:searchSuggestAuthority="my.package.dataproviders.TicketSuggestionProvider"
            android:searchSuggestIntentData="content://my.package.dataproviders.TicketSuggestionProvider/titleslist"
            android:searchSuggestIntentAction="android.Intent.action.VIEW" // HERE IT IS
            android:searchSuggestSelection=" ?">
</searchable>


出现了问题,正确的字符串应该是“android.intent.action.VIEW”,在“intent”中使用小写的“i”。@Joe确实注意到了这一点。非常奇怪…看看你是否能找到发送意图的代码,很可能那里有错误。@Joe,是的,我找到了它所在的位置。你可能只是从中复制了错误-他们使用大写字母“I”5次中的2次。当我从那个页面复制了一行XML时,我也是这样做的。
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
            android:label="@string/appname"
            android:hint="@string/search_hint"
            android:searchSuggestAuthority="my.package.dataproviders.TicketSuggestionProvider"
            android:searchSuggestIntentData="content://my.package.dataproviders.TicketSuggestionProvider/titleslist"
            android:searchSuggestIntentAction="android.Intent.action.VIEW" // HERE IT IS
            android:searchSuggestSelection=" ?">
</searchable>