当前位置: 首页>>代码示例>>Java>>正文


Java BaseColumns._ID属性代码示例

本文整理汇总了Java中android.provider.BaseColumns._ID属性的典型用法代码示例。如果您正苦于以下问题:Java BaseColumns._ID属性的具体用法?Java BaseColumns._ID怎么用?Java BaseColumns._ID使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.provider.BaseColumns的用法示例。


在下文中一共展示了BaseColumns._ID属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: refreshShortcut

private Cursor refreshShortcut(Uri uri) {
  /* This won't be called with the current implementation, but if we include
   * {@link SearchManager#SUGGEST_COLUMN_SHORTCUT_ID} as a column in our suggestions table, we
   * could expect to receive refresh queries when a shortcutted suggestion is displayed in
   * Quick Search Box. In which case, this method will query the table for the specific
   * word, using the given item Uri and provide all the columns originally provided with the
   * suggestion query.
   */
  String rowId = uri.getLastPathSegment();
  String[] columns = new String[] {
      BaseColumns._ID,
      DictionaryDatabase.KEY_WORD,
      DictionaryDatabase.KEY_DEFINITION,
      SearchManager.SUGGEST_COLUMN_SHORTCUT_ID,
      SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID};

  return mDictionary.getWord(rowId, columns);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:18,代码来源:DictionaryProvider.java

示例2: createContentCursorFor

/**
 * Creates a cursor that contains contacts group corresponding to an sip
 * account.
 */
private Cursor createContentCursorFor(SipProfile account) {
    Cursor c = null;
    if(!TextUtils.isEmpty(account.android_group)) {
        c = ContactsWrapper.getInstance().getContactsByGroup(getContext(), account.android_group);
    }
    if(c != null) {
        return c;
    }
    MatrixCursor mc = new MatrixCursor (new String[] {
            BaseColumns._ID, 
            ContactsWrapper.FIELD_TYPE
    });
    mc.addRow(new Object[] {account.id, ContactsWrapper.TYPE_CONFIGURE});
    return mc;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:19,代码来源:FavLoader.java

示例3: onCreateLoader

public Loader<Cursor> onCreateLoader(int loaderID, Bundle bundle) {
    if (loaderID == mLoaderManagerId && (mUri != null || mVideoId != -1)) {
        String selection = (mVideoId != -1 ? BaseColumns._ID : MediaColumns.DATA) + "=?";
        if(LoaderUtils.mustHideUserHiddenObjects())
            selection += " AND "+LoaderUtils.HIDE_USER_HIDDEN_FILTER;
        CursorLoader cursorLoader =  new CursorLoader(
                mContext,
                VideoStore.Video.Media.EXTERNAL_CONTENT_URI,
                VideoDbInfo.COLUMNS,selection
                 ,
                new String [] {(mVideoId != -1 ? String.valueOf(mVideoId) : mUri.toString())},
                null);
        if(mLoaderManager==null)
            cursorLoader.registerListener(loaderID, this);
        return cursorLoader;
    }
    return null;
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:18,代码来源:IndexHelper.java

示例4: getSongListForAlbum

/**
 * @param context The {@link Context} to use.
 * @param id      The ID of the album.
 * @return The song list for an album.
 */
public static final long[] getSongListForAlbum(final Context context, final long id) {
    final String[] projection = new String[]{
            BaseColumns._ID
    };
    final String selection = AudioColumns.ALBUM_ID + "=" + id + " AND " + AudioColumns.IS_MUSIC
            + "=1";
    Cursor cursor = context.getContentResolver().query(
            MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, selection, null,
            AudioColumns.TRACK + ", " + MediaStore.Audio.Media.DEFAULT_SORT_ORDER);
    if (cursor != null) {
        final long[] mList = getSongListForCursor(cursor);
        cursor.close();
        cursor = null;
        return mList;
    }
    return sEmptyList;
}
 
开发者ID:komamj,项目名称:KomaMusic,代码行数:22,代码来源:MusicUtils.java

示例5: getSongListForGenre

/**
 * @param context The {@link Context} to use.
 * @param id      The ID of the genre.
 * @return The song list for an genre.
 */
public static final long[] getSongListForGenre(final Context context, final long id) {
    final String[] projection = new String[]{
            BaseColumns._ID
    };
    String selection = (AudioColumns.IS_MUSIC + "=1") +
            " AND " + MediaColumns.TITLE + "!=''";
    final Uri uri = MediaStore.Audio.Genres.Members.getContentUri("external", Long.valueOf(id));
    Cursor cursor = context.getContentResolver().query(uri, projection, selection,
            null, null);
    if (cursor != null) {
        final long[] mList = getSongListForCursor(cursor);
        cursor.close();
        cursor = null;
        return mList;
    }
    return sEmptyList;
}
 
开发者ID:komamj,项目名称:KomaMusic,代码行数:22,代码来源:MusicUtils.java

示例6: update

public int update(SubTaskRecord record) {
    SQLiteDatabase db = RecordManager.openDatabase();
    ContentValues values = contentValuesToRecord(record);
    String whereClause = BaseColumns._ID + "=?";
    String[] whereArgs = {String.valueOf(record.getId())};
    int count = db.update(TABLE_NAME, values, whereClause, whereArgs);
    //Debug.log("更新"+count+"条子任务记录" + record);
    return count;
}
 
开发者ID:4pp,项目名称:downloader,代码行数:9,代码来源:SubTaskRecordDAO.java

示例7: setSuggestions

public void setSuggestions(List<String> suggestions) {
    final MatrixCursor c = new MatrixCursor(new String[]{ BaseColumns._ID, SUGGEST_COLUMN });
    for (int i = 0; i < suggestions.size(); ++i) {
        c.addRow(new Object[] {i, suggestions.get(i)});
    }
    changeCursor(c);
    mSuggestions = suggestions;
}
 
开发者ID:datdescartes,项目名称:pokequest,代码行数:8,代码来源:SuggestAdapter.java

示例8: setRingtone

/**
 * @param context The {@link Context} to use
 * @param id      The song ID.
 */
public static void setRingtone(final Context context, final long id) {
    final ContentResolver resolver = context.getContentResolver();
    final Uri uri = ContentUris.withAppendedId(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, id);
    try {
        final ContentValues values = new ContentValues(2);
        values.put(AudioColumns.IS_RINGTONE, "1");
        values.put(AudioColumns.IS_ALARM, "1");
        resolver.update(uri, values, null, null);
    } catch (final UnsupportedOperationException ingored) {
        return;
    }

    final String[] projection = new String[]{
            BaseColumns._ID, MediaColumns.DATA, MediaColumns.TITLE
    };

    final String selection = BaseColumns._ID + "=" + id;
    Cursor cursor = resolver.query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection,
            selection, null, null);
    try {
        if (cursor != null && cursor.getCount() == 1) {
            cursor.moveToFirst();
            Settings.System.putString(resolver, Settings.System.RINGTONE, uri.toString());
            final String message = context.getString(R.string.set_as_ringtone,
                    cursor.getString(2));
            Toast.makeText((Activity) context, message, Toast.LENGTH_SHORT).show();
        }
    } finally {
        if (cursor != null) {
            cursor.close();
            cursor = null;
        }
    }
}
 
开发者ID:komamj,项目名称:KomaMusic,代码行数:38,代码来源:MusicUtils.java

示例9: initAdapter

private void initAdapter() {
    String[] fromColumns = {BaseColumns._ID,
            MeatDishContract.COLUMN_NAME_DATE,
            MeatDishContract.COLUMN_NAME_SORT_OF_MEAT,
            MeatDishContract.COLUMN_NAME_AMOUNT};
    int[] toViews = {R.id.imageView_history,
            R.id.textView_history_date,
            R.id.textView_history_meat,
            R.id.textView_history_amount};

    adapter = new HistoryCursorAdapter(this, fromColumns, toViews);
    listView.setAdapter(adapter);
}
 
开发者ID:mr-kojo,项目名称:Veggietizer,代码行数:13,代码来源:HistoryActivity.java

示例10: onCreateLoader

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
	 return new CursorLoader(getActivity(), SipManager.FILTER_URI, new String[] {
		BaseColumns._ID,
		Filter.FIELD_ACCOUNT,
           Filter.FIELD_ACTION,
           Filter.FIELD_MATCHES,
		Filter.FIELD_PRIORITY,
		Filter.FIELD_REPLACE
	 }, Filter.FIELD_ACCOUNT + "=?", new String[] {Long.toString(accountId)}, Filter.DEFAULT_ORDER);
	 
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:12,代码来源:AccountFiltersListFragment.java

示例11: forwardDelete

private int forwardDelete(SQLiteDatabase db, String table, String selection, String[] selectionArgs) {
    String deleteIds = null;
    Cursor c = db.query(table, PROJECTION_IDS, selection, selectionArgs, null, null, null);
    if (c != null) {
        if (c.moveToFirst()) {
            deleteIds = c.getString(0);
        }
        c.close();
    }
    if (deleteIds == null || deleteIds.isEmpty())
        return 0;

    String where = BaseColumns._ID + " IN (" + deleteIds + ")";
    return mCr.delete(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, where, null);
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:15,代码来源:MusicProvider.java

示例12: update

public int update(TaskRecord record) {
    //Debug.log("更新任务记录" + record);
    SQLiteDatabase db = RecordManager.openDatabase();
    ContentValues values = contentValuesToRecord(record);
    String whereClause = BaseColumns._ID + "=?";
    String[] whereArgs = {String.valueOf(record.getId())};
    return db.update(TABLE_NAME, values, whereClause, whereArgs);
}
 
开发者ID:4pp,项目名称:downloader,代码行数:8,代码来源:TaskRecordDAO.java

示例13: buildProjection

private void buildProjection() {
    String quoted = getContext().getString(R.string.quotation_format, QUOTED_CONTENT);
    String line2 = LINE2_START + quoted + LINE2_END;

    mProjection = new String []{
            BaseColumns._ID,
            LINE1,
            line2,
            ICON,
            CONTENT_ID
    };
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:12,代码来源:VideoSearchProvider.java

示例14: shareTrack

public static void shareTrack(final Context context, long id) {

        final String[] projection = new String[]{
                BaseColumns._ID, MediaStore.MediaColumns.DATA, MediaStore.Audio.AudioColumns.ALBUM_ID
        };
        final StringBuilder selection = new StringBuilder();
        selection.append(BaseColumns._ID + " IN (");
        selection.append(id);
        selection.append(")");
        final Cursor c = context.getContentResolver().query(
                MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, selection.toString(),
                null, null);

        if (c == null) {
            return;
        }
        c.moveToFirst();
        try {
            Intent share = new Intent(Intent.ACTION_SEND);
            share.setType("audio/*");
            share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(c.getString(1))));
            context.startActivity(Intent.createChooser(share, "Share"));
            c.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:27,代码来源:TimberUtils.java

示例15: populateSuggestionsAdapter

private void populateSuggestionsAdapter(String query) {
    final MatrixCursor c = new MatrixCursor(new String[]{BaseColumns._ID, "suggestion"});
    List<String> suggestionsForQuery = getSuggestionsForQuery(query);
    for (int i = 0, suggestionsForQuerySize = suggestionsForQuery.size(); i < suggestionsForQuerySize; i++) {
        String suggestion = suggestionsForQuery.get(i);
        c.addRow(new Object[]{i, suggestion});
    }
    mSearchSuggestionsAdapter.changeCursor(c);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:9,代码来源:LogcatActivity.java


注:本文中的android.provider.BaseColumns._ID属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。