本文整理匯總了Java中android.app.SearchManager.SHORTCUT_MIME_TYPE屬性的典型用法代碼示例。如果您正苦於以下問題:Java SearchManager.SHORTCUT_MIME_TYPE屬性的具體用法?Java SearchManager.SHORTCUT_MIME_TYPE怎麽用?Java SearchManager.SHORTCUT_MIME_TYPE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.app.SearchManager
的用法示例。
在下文中一共展示了SearchManager.SHORTCUT_MIME_TYPE屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getType
@Override
public String getType(@NonNull Uri uri) {
switch (sUriMatcher.match(uri)) {
// The application is querying the db for its own contents.
case VIDEO_WITH_CATEGORY:
return VideoContract.VideoEntry.CONTENT_TYPE;
case VIDEO:
return VideoContract.VideoEntry.CONTENT_TYPE;
// The Android TV global search is querying our app for relevant content.
case SEARCH_SUGGEST:
return SearchManager.SUGGEST_MIME_TYPE;
case REFRESH_SHORTCUT:
return SearchManager.SHORTCUT_MIME_TYPE;
// We aren't sure what is being asked of us.
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
}
示例2: getType
/**
* This method is required in order to query the supported types.
* It's also useful in our own query() method to determine the type of Uri received.
*/
@Override
public String getType(Uri uri) {
switch (sURIMatcher.match(uri)) {
case SEARCH_WORDS:
return WORDS_MIME_TYPE;
case GET_WORD:
return DEFINITION_MIME_TYPE;
case SEARCH_SUGGEST:
return SearchManager.SUGGEST_MIME_TYPE;
case REFRESH_SHORTCUT:
return SearchManager.SHORTCUT_MIME_TYPE;
default:
throw new IllegalArgumentException("Unknown URL " + uri);
}
}