本文整理汇总了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);
}
}