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


Java BaseColumns类代码示例

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


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

示例1: createTablesV2

import android.provider.BaseColumns; //导入依赖的package包/类
private void createTablesV2(SQLiteDatabase db) {
    db.execSQL("CREATE TABLE " + TABLE_CONNECTION + " (" +
            BaseColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
            ConnectionColumns.NAME + " TEXT," +
            ConnectionColumns.TYPE + " TEXT," +
            ConnectionColumns.SCHEME + " TEXT," +
            ConnectionColumns.PATH + " TEXT," +
            ConnectionColumns.HOST + " TEXT," +
            ConnectionColumns.PORT + " INTEGER," +
            ConnectionColumns.USERNAME + " TEXT," +
            ConnectionColumns.PASSWORD + " TEXT," +
            ConnectionColumns.ANONYMOUS_LOGIN + " BOOLEAN," +
            "UNIQUE (" + ConnectionColumns.NAME + ", " + ConnectionColumns.HOST + ", " + ConnectionColumns.PATH +  ") ON CONFLICT REPLACE " +
            ")");

    addDefaultServer(db);
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:18,代码来源:ExplorerProvider.java

示例2: createContentCursorFor

import android.provider.BaseColumns; //导入依赖的package包/类
/**
 * 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,代码行数:20,代码来源:FavLoader.java

示例3: onCreateLoader

import android.provider.BaseColumns; //导入依赖的package包/类
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,代码行数:19,代码来源:IndexHelper.java

示例4: onPopupMenuItemClick

import android.provider.BaseColumns; //导入依赖的package包/类
public boolean onPopupMenuItemClick(MenuItem item, int position) {
    final Cursor cursor = mAdapter.getItem(position);
    int connection_id = getCursorInt(cursor, BaseColumns._ID);
    NetworkConnection networkConnection = NetworkConnection.fromConnectionsCursor(cursor);
    final int id = item.getItemId();
    switch (id) {
        case R.id.menu_edit:
            editConnection(connection_id);
            return true;
        case R.id.menu_delete:
            if(!networkConnection.type.equals(SERVER)) {
                deleteConnection(connection_id);
            } else {
                ((BaseActivity)getActivity())
                        .showSnackBar("Default server connection can't be deleted",
                                Snackbar.LENGTH_SHORT);
            }
            return true;
        default:
            return false;
    }
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:23,代码来源:ConnectionsFragment.java

示例5: getMeatDishes

import android.provider.BaseColumns; //导入依赖的package包/类
/**
 * Returns all stored meat dishes that belong to the specified period of time.
 * Consider calling this method from within an {@link AsyncTask} to prevent the UI from freezing.
 *
 * @param periodStart The first day of the period (inclusive) or <code>null</code> if no start limit.
 * @param periodEnd The last day of the period (inclusive) or <code>null</code> if no end limit.
 * @return The stored meat dishes, ordered by date (latest first), or an empty array if none available.
 */
public MeatDish[] getMeatDishes(Date periodStart, Date periodEnd) {
    Cursor cursor = getMeatDishesCursor(periodStart, periodEnd);
    MeatDish[] meatDishes = new MeatDish[cursor.getCount()];

    cursor.moveToFirst();
    for (int i = 0; i < meatDishes.length; ++i) {
        int id = cursor.getInt(cursor.getColumnIndex(BaseColumns._ID));
        String dateStr = cursor.getString(cursor.getColumnIndex(MeatDishContract.COLUMN_NAME_DATE));
        String sort = cursor.getString(cursor.getColumnIndex(MeatDishContract.COLUMN_NAME_SORT_OF_MEAT));
        int amount = cursor.getShort(cursor.getColumnIndex(MeatDishContract.COLUMN_NAME_AMOUNT));
        Date date = DateParser.parseISO2014(dateStr, null);
        Meat meat = Meat.valueOf(sort);
        meatDishes[i] = new MeatDish(id, date, meat, amount);
        cursor.moveToNext();
    }

    cursor.close();       
    return meatDishes;
}
 
开发者ID:mr-kojo,项目名称:Veggietizer,代码行数:28,代码来源:DatabaseAccess.java

示例6: deleteConnection

import android.provider.BaseColumns; //导入依赖的package包/类
public static boolean deleteConnection(Context context, int id) {
    try {
        int resultId = context.getContentResolver()
                .delete(ExplorerProvider.buildConnection(),
                        BaseColumns._ID + "=? "
                        , new String[]{Integer.toString(id)});
        if (0 != resultId) {
            return true;
        }
    } catch (Exception e) {
        Log.w(TAG, "Failed to load some roots from " + NetworkStorageProvider.AUTHORITY + ": " + e);
    }

    return false;
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:16,代码来源:NetworkConnection.java

示例7: updateConnections

import android.provider.BaseColumns; //导入依赖的package包/类
public void updateConnections() {
    Cursor cursor = null;
    mRoots.clear();
    try {
        cursor = getContext().getContentResolver().query(ExplorerProvider.buildConnection(), null, null, null, null);
        while (cursor.moveToNext()) {
            int id = getCursorInt(cursor, BaseColumns._ID);
            NetworkConnection networkConnection = NetworkConnection.fromConnectionsCursor(cursor);
            mRoots.put(networkConnection.getHost(), networkConnection);
        }
    } catch (Exception e) {
        Log.w(TAG, "Failed to load some roots from " + ExplorerProvider.AUTHORITY + ": " + e);
        CrashReportingManager.logException(e);
    } finally {
        IoUtils.closeQuietly(cursor);
    }

    notifyRootsChanged(getContext());
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:20,代码来源:NetworkStorageProvider.java

示例8: getSongListForArtist

import android.provider.BaseColumns; //导入依赖的package包/类
public static final long[] getSongListForArtist(final Context context, final long id) {
    final String[] projection = new String[]{
            BaseColumns._ID
    };
    final String selection = MediaStore.Audio.AudioColumns.ARTIST_ID + "=" + id + " AND "
            + MediaStore.Audio.AudioColumns.IS_MUSIC + "=1";
    Cursor cursor = context.getContentResolver().query(
            MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, selection, null,
            MediaStore.Audio.AudioColumns.ALBUM_KEY + "," + MediaStore.Audio.AudioColumns.TRACK);
    if (cursor != null) {
        final long[] mList = SongLoader.getSongListForCursor(cursor);
        cursor.close();
        cursor = null;
        return mList;
    }
    return sEmptyList;
}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:18,代码来源:MusicPlayer.java

示例9: getSongListForAlbum

import android.provider.BaseColumns; //导入依赖的package包/类
public static final long[] getSongListForAlbum(final Context context, final long id) {
    final String[] projection = new String[]{
            BaseColumns._ID
    };
    final String selection = MediaStore.Audio.AudioColumns.ALBUM_ID + "=" + id + " AND " + MediaStore.Audio.AudioColumns.IS_MUSIC
            + "=1";
    Cursor cursor = context.getContentResolver().query(
            MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, selection, null,
            MediaStore.Audio.AudioColumns.TRACK + ", " + MediaStore.Audio.Media.DEFAULT_SORT_ORDER);
    if (cursor != null) {
        final long[] mList = SongLoader.getSongListForCursor(cursor);
        cursor.close();
        cursor = null;
        return mList;
    }
    return sEmptyList;
}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:18,代码来源:MusicPlayer.java

示例10: value

import android.provider.BaseColumns; //导入依赖的package包/类
@Override
public Integer value()
{
    Cursor cursor = null;
    try
    {
        cursor = mView.rows(EmptyUriParams.INSTANCE, new SingleColProjection(BaseColumns._ID), mPredicate, Absent.<String>absent());
        return cursor.getCount();
    }
    catch (RemoteException e)
    {
        throw new RuntimeException("Query failed", e);
    }
    finally
    {
        if (cursor != null)
        {
            cursor.close();
        }
    }
}
 
开发者ID:dmfs,项目名称:ContentPal,代码行数:22,代码来源:RowCount.java

示例11: fillArtistAlbumsMap

import android.provider.BaseColumns; //导入依赖的package包/类
private static void fillArtistAlbumsMap() {
    sArtistAlbumsMap.put(BaseColumns._ID, "audio.album_id AS " +
            BaseColumns._ID);
    sArtistAlbumsMap.put(AlbumColumns.ALBUM, "album");
    sArtistAlbumsMap.put(AlbumColumns.ALBUM_KEY, "album_key");
    sArtistAlbumsMap.put(AlbumColumns.FIRST_YEAR, "MIN(year) AS " +
            AlbumColumns.FIRST_YEAR);
    sArtistAlbumsMap.put(AlbumColumns.LAST_YEAR, "MAX(year) AS " +
            AlbumColumns.LAST_YEAR);
    sArtistAlbumsMap.put(AudioColumns.ARTIST, "artist");
    sArtistAlbumsMap.put(AudioColumns.ARTIST_ID, "artist");
    sArtistAlbumsMap.put(AudioColumns.ARTIST_KEY, "artist_key");
    sArtistAlbumsMap.put(AlbumColumns.NUMBER_OF_SONGS, "count(*) AS " +
            AlbumColumns.NUMBER_OF_SONGS);
    sArtistAlbumsMap.put(AlbumColumns.ALBUM_ART, "album_art._data AS " +
            AlbumColumns.ALBUM_ART);
    sArtistAlbumsMap.put(AlbumColumns.IS_ARCHOS_FAVORITE, "audio.Archos_favorite_album AS " +
            AlbumColumns.IS_ARCHOS_FAVORITE);
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:20,代码来源:MusicProvider.java

示例12: getSongListForCursor

import android.provider.BaseColumns; //导入依赖的package包/类
/**
 * @param cursor The {@link Cursor} used to perform our query.
 * @return The song list for a MIME type.
 */
public static final long[] getSongListForCursor(Cursor cursor) {
    if (cursor == null) {
        return sEmptyList;
    }
    final int len = cursor.getCount();
    final long[] list = new long[len];
    cursor.moveToFirst();
    int columnIndex = -1;
    try {
        columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Audio.Playlists.Members.AUDIO_ID);
    } catch (final IllegalArgumentException notaplaylist) {
        columnIndex = cursor.getColumnIndexOrThrow(BaseColumns._ID);
    }
    for (int i = 0; i < len; i++) {
        list[i] = cursor.getLong(columnIndex);
        cursor.moveToNext();
    }
    cursor.close();
    cursor = null;
    return list;
}
 
开发者ID:komamj,项目名称:KomaMusic,代码行数:26,代码来源:MusicUtils.java

示例13: fromConnectionId

import android.provider.BaseColumns; //导入依赖的package包/类
public static NetworkConnection fromConnectionId(Context context, int id) {
    Cursor cursor = null;
    NetworkConnection networkConnection = null;
    try {
        cursor = context.getContentResolver()
                .query(ExplorerProvider.buildConnection(), null,
                        BaseColumns._ID + "=? "
                        , new String[]{Integer.toString(id)}, null);
        if (null != cursor && cursor.moveToFirst()) {
            networkConnection = NetworkConnection.fromConnectionsCursor(cursor);
        }
    } catch (Exception e) {
        Log.w(TAG, "Failed to load some roots from " + NetworkStorageProvider.AUTHORITY + ": " + e);
        CrashReportingManager.logException(e);
    } finally {
        IoUtils.closeQuietly(cursor);
    }

    return networkConnection;
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:21,代码来源:NetworkConnection.java

示例14: getSongListForAlbum

import android.provider.BaseColumns; //导入依赖的package包/类
/**
 * @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,代码行数:23,代码来源:MusicUtils.java

示例15: getIdForPlaylist

import android.provider.BaseColumns; //导入依赖的package包/类
/**
 * Returns The ID for a playlist.
 *
 * @param context The {@link Context} to use.
 * @param name    The name of the playlist.
 * @return The ID for a playlist.
 */
public static final long getIdForPlaylist(final Context context, final String name) {
    Cursor cursor = context.getContentResolver().query(
            MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, new String[]{
                    BaseColumns._ID
            }, PlaylistsColumns.NAME + "=?", new String[]{
                    name
            }, PlaylistsColumns.NAME);
    int id = -1;
    if (cursor != null) {
        cursor.moveToFirst();
        if (!cursor.isAfterLast()) {
            id = cursor.getInt(0);
        }
        cursor.close();
        cursor = null;
    }
    return id;
}
 
开发者ID:komamj,项目名称:KomaMusic,代码行数:26,代码来源:MusicUtils.java


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