當前位置: 首頁>>代碼示例>>Java>>正文


Java SearchManager.SUGGEST_COLUMN_INTENT_DATA屬性代碼示例

本文整理匯總了Java中android.app.SearchManager.SUGGEST_COLUMN_INTENT_DATA屬性的典型用法代碼示例。如果您正苦於以下問題:Java SearchManager.SUGGEST_COLUMN_INTENT_DATA屬性的具體用法?Java SearchManager.SUGGEST_COLUMN_INTENT_DATA怎麽用?Java SearchManager.SUGGEST_COLUMN_INTENT_DATA使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.app.SearchManager的用法示例。


在下文中一共展示了SearchManager.SUGGEST_COLUMN_INTENT_DATA屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: GetStationsForSearchProvider

public Cursor GetStationsForSearchProvider(String selection,
                                               String[] selectionArgs) {
        //prepare query for search suggesions
        Cursor cursor;
        StorageHelper storageHelper = new StorageHelper(mContect);
        final File folder = storageHelper.getCollectionDirectory();

        String[] projection = new String[]{
                StationsDbContract.StationEntry._ID,
                StationsDbContract.StationEntry.COLUMN_NAME_TITLE + " AS " + SearchManager.SUGGEST_COLUMN_TEXT_2,
                StationsDbContract.StationEntry.COLUMN_NAME_SUBTITLE + " AS " + SearchManager.SUGGEST_COLUMN_TEXT_1,
                StationsDbContract.StationEntry._ID + " AS " + SearchManager.SUGGEST_COLUMN_INTENT_DATA
                , "'file://" + folder.toString() + "/'  || " + StationsDbContract.StationEntry.COLUMN_IMAGE_FILE_NAME + " AS " + SearchManager.SUGGEST_COLUMN_ICON_1,
        };
        //get stations from DB
        // Gets the data repository in read mode
        SQLiteDatabase db = this.getReadableDatabase();
        try {
            cursor = db.query(
                    TABLE_NAME, // The table to query
                    projection,                                 // The columns to return
                    selection,                                  // The columns for the WHERE clause
                    new String[]{"%" + selectionArgs[0].toString() + "%","%" + selectionArgs[0].toString() + "%"},  // The values for the WHERE clause
                    null,                                       // don't group the rows
                    null,                                       // don't filter by row groups
                    null,
                    "20" //limit
            );
            return cursor;
        } catch (Exception ex) {
            LogHelper.e(LOG_TAG, ex.getMessage());
            return null;
        }

//
//
//        String countQuery = "SELECT  " + StationsDbContract.StationEntry._ID + "AS _ID,"
//                + StationsDbContract.StationEntry.COLUMN_NAME_TITLE + " AS SUGGEST_COLUMN_TEXT_1,"
//                + StationsDbContract.StationEntry.COLUMN_NAME_SUBTITLE + " AS SUGGEST_COLUMN_TEXT_2,"
//                + "'file://" + folder.toString() + "/'  || " + StationsDbContract.StationEntry.COLUMN_SMALL_IMAGE_FILE_NAME + " AS SUGGEST_COLUMN_ICON_1,"
//                + " FROM " + StationsDbContract.StationEntry.TABLE_NAME;
////                + " WHERE " + StationsDbContract.StationEntry.COLUMN_NAME_TITLE + " LIKE '%" + searchText + "%'"
////                + " Or " + StationsDbContract.StationEntry.COLUMN_NAME_SUBTITLE + " LIKE '%" + searchText + "%'" ;
//        SQLiteDatabase db = this.getReadableDatabase();
//        Cursor cursor = db.rawQuery(countQuery, null);
//        return cursor;
    }
 
開發者ID:malah-code,項目名稱:Open-Quran-Radio,代碼行數:47,代碼來源:StationsDbHelper.java


注:本文中的android.app.SearchManager.SUGGEST_COLUMN_INTENT_DATA屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。