Java Code Examples for android.database.Cursor.getInt()

The following are Jave code examples for showing how to use getInt() of the android.database.Cursor class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: QuranAndroid   File: DatabaseAccess.java   Source Code and License Vote up 6 votes
public int getPageHezb(int pageNumber) {
    int hezbNumber = 0;
    try {
        SQLiteDatabase db = openDB(MAIN_DATABASE);
        String sql = "select hezb from aya where page = " + pageNumber + " ;";
        Cursor cursor = db.rawQuery(sql, null);

        if(cursor.moveToLast()){
            hezbNumber = cursor.getInt(0);
        }
        cursor.close();
        closeDB(db);
        return hezbNumber;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return hezbNumber;
}
 
Example 2
Project: Reactive-Android-Programming   File: StockUpdateGetResolver.java   Source Code and License Vote up 6 votes
@NonNull
@Override
public StockUpdate mapFromCursor(@NonNull Cursor cursor) {

    final int id = cursor.getInt(cursor.getColumnIndexOrThrow(StockUpdateTable.Columns.ID));
    final long dateLong = cursor.getLong(cursor.getColumnIndexOrThrow(StockUpdateTable.Columns.DATE));
    final long priceLong = cursor.getLong(cursor.getColumnIndexOrThrow(StockUpdateTable.Columns.PRICE));
    final String stockSymbol = cursor.getString(cursor.getColumnIndexOrThrow(StockUpdateTable.Columns.STOCK_SYMBOL));
    final String twitterStatus = cursor.getString(cursor.getColumnIndexOrThrow(StockUpdateTable.Columns.TWITTER_STATUS));


    Date date = getDate(dateLong);
    BigDecimal price = getPrice(priceLong);

    final StockUpdate stockUpdate = new StockUpdate(
            stockSymbol,
            price,
            date,
            twitterStatus
    );

    stockUpdate.setId(id);

    return stockUpdate;
}
 
Example 3
Project: letv   File: DownloadTraceHandler.java   Source Code and License Vote up 6 votes
public DownloadDBListBean getAllFinishLatestThreeDownLoadTrace() {
    try {
        Cursor cursor = this.mContext.getContentResolver().query(LetvContentProvider.URI_DOWNLOADTRACE, null, "finish=?", new String[]{"4"}, "timestamp DESC");
        DownloadDBListBean arrayList = new DownloadDBListBean();
        ArrayList<Integer> albumIdList = new ArrayList();
        int count = 0;
        while (cursor.moveToNext() && count < 3) {
            DownloadDBBean mDownloadDBBean = new DownloadDBBean();
            int albumId = cursor.getInt(cursor.getColumnIndex(PageJumpUtil.IN_TO_ALBUM_PID));
            mDownloadDBBean.aid = albumId;
            mDownloadDBBean.episodetitle = cursor.getString(cursor.getColumnIndex("episodetitle"));
            mDownloadDBBean.albumtitle = cursor.getString(cursor.getColumnIndex(DownloadAlbumTable.COLUMN_ALBUMTITLE));
            if (!albumIdList.contains(Integer.valueOf(albumId))) {
                albumIdList.add(Integer.valueOf(albumId));
                arrayList.add(mDownloadDBBean);
                count++;
            }
        }
        LetvTools.closeCursor(cursor);
        return arrayList;
    } catch (Throwable th) {
        LetvTools.closeCursor(null);
    }
}
 
Example 4
Project: FastCamera   File: FastCameraActivity.java   Source Code and License Vote up 6 votes
public Uri getImageContentUri(File imageFile) {
    String filePath = imageFile.getAbsolutePath();
    Cursor cursor = getContentResolver().query(
            MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
            new String[]{MediaStore.Images.Media._ID},
            MediaStore.Images.Media.DATA + "=? ",
            new String[]{filePath}, null);

    if (cursor != null && cursor.moveToFirst()) {
        int id = cursor.getInt(cursor.getColumnIndex(MediaStore.MediaColumns._ID));
        Uri baseUri = Uri.parse("content://media/external/images/media");
        cursor.close();
        return Uri.withAppendedPath(baseUri, "" + id);
    } else {
        if (imageFile.exists()) {
            ContentValues values = new ContentValues();
            values.put(MediaStore.Images.Media.DATA, filePath);
            if (cursor != null) {
                cursor.close();
            }
            return getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
        } else {
            return null;
        }
    }
}
 
Example 5
Project: quiz_helper   File: CustomDictionaryDbHelper.java   Source Code and License Vote up 6 votes
@Nullable  //if null, not found
public CustomDictionaryInformation getDictInfo(int dictId){
    Cursor cursor = getReadableDatabase().query(
            TB_DICT,
            new String[] {CL_ID, CL_NAME, CL_DESCRIPTION, CL_LANG, CL_TMPL, CL_ELEMENTS},
            CL_ID + "=" + dictId,
            null,
            null,
            null,
            null
    );
    CustomDictionaryInformation customDictionaryInformation = null;
    while(cursor.moveToNext()){
        customDictionaryInformation = new CustomDictionaryInformation(
                cursor.getInt(0),
                cursor.getString(1),
                cursor.getString(2),
                cursor.getString(3),
                cursor.getString(4),
                fromFieldsString(cursor.getString(5))
        );
    }
    return customDictionaryInformation;
}
 
Example 6
Project: MeetMusic   File: DBManager.java   Source Code and License Vote up 6 votes
public void insertMusicInfoToMusicTable(MusicInfo musicInfo) {
        ContentValues values;
        Cursor cursor = null;
        int id = 1;
        try {
            values = musicInfoToContentValues(musicInfo);
            String sql = "select max(id) from " + DatabaseHelper.MUSIC_TABLE + ";";
            cursor = db.rawQuery(sql, null);
            if (cursor.moveToFirst()) {
                //设置新添加的ID为最大ID+1
                id = cursor.getInt(0) + 1;
            }
            values.put(ID_COLUMN, id);
//			values.put("mylove",0);
            db.insert(DatabaseHelper.MUSIC_TABLE, null, values);
        } catch (Exception e) {
            e.printStackTrace();
            if (cursor!=null){
                cursor.close();
            }
        }
    }
 
Example 7
Project: GitHub   File: DoubanMomentPresenter.java   Source Code and License Vote up 5 votes
private boolean queryIfIDExists(int id){
    Cursor cursor = db.query("Douban",null,null,null,null,null,null);
    if (cursor.moveToFirst()){
        do {
            if (id == cursor.getInt(cursor.getColumnIndex("douban_id"))){
                return true;
            }
        } while (cursor.moveToNext());
    }
    cursor.close();

    return false;
}
 
Example 8
Project: PictureShow   File: PhotoActivity.java   Source Code and License Vote up 5 votes
@Override
public void onClick(View v) {

    if(photoPageAdapter == null) return;

    Cursor c = (Cursor)photoPageAdapter.getDataItem(currentID);
    String type = c.getString(MediaSetUtils.INDEX_ITEM_TYPE);
    int rowID = c.getInt(MediaSetUtils.INDEX_ID);
    boolean image = PicShowUtils.isImage(type);
    Uri baseUri = image ? MediaStore.Images.Media.EXTERNAL_CONTENT_URI :
            MediaStore.Video.Media.EXTERNAL_CONTENT_URI;

    Uri u = baseUri.buildUpon().appendPath(String.valueOf(rowID)).build();

    switch (v.getId()) {
        case R.id.share:
            menuExecutor.execute(MenuExecutor.MENU_ACTION_SHARE, u, image);
            break;

        case R.id.edit:
            menuExecutor.execute(MenuExecutor.MENU_ACTION_SHARE, u, image);
            break;

        case R.id.delete:
            menuExecutor.execute(MenuExecutor.MENU_ACTION_DELETE, u, image);
            break;

        case R.id.more:
            showMoreMenu();
            break;
    }

}
 
Example 9
Project: phonk   File: PNetwork.java   Source Code and License Vote up 5 votes
@ProtoMethod(description = "Downloads a file from a given Uri. Returns the progress", example = "")
public void downloadWithSystemManager(String url, final ReturnInterface callback) {
    final DownloadManager dm = (DownloadManager) getContext().getSystemService(getContext().DOWNLOAD_SERVICE);
    DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
    final long enqueue = dm.enqueue(request);

    BroadcastReceiver receiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) {
                long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, 0);
                DownloadManager.Query query = new DownloadManager.Query();
                query.setFilterById(enqueue);
                Cursor c = dm.query(query);
                if (c.moveToFirst()) {
                    int columnIndex = c
                            .getColumnIndex(DownloadManager.COLUMN_STATUS);
                    if (DownloadManager.STATUS_SUCCESSFUL == c.getInt(columnIndex)) {
                        if (callback != null) callback.event(null);
                        // callback successful
                    }
                }
            }
        }
    };

    getContext().registerReceiver(receiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));


}
 
Example 10
Project: GitHub   File: GuokrPresenter.java   Source Code and License Vote up 5 votes
private boolean queryIfIDExists(int id){
    Cursor cursor = db.query("Guokr",null,null,null,null,null,null);
    if (cursor.moveToFirst()){
        do {
            if (id == cursor.getInt(cursor.getColumnIndex("guokr_id"))){
                return true;
            }
        } while (cursor.moveToNext());
    }
    cursor.close();

    return false;
}
 
Example 11
Project: oma-riista-android   File: DiaryDataSource.java   Source Code and License Vote up 5 votes
/**
 * Iterates sqlite cursor and builds complete GameHarvest objects
 *
 * @param cursor           sqlite cursor
 * @param getDeletedImages
 * @return List of GameHarvest objects
 */
private List<GameHarvest> aggregateEvents(Cursor cursor, boolean getDeletedImages) {
    cursor.moveToFirst();
    List<LogImage> logImages = new ArrayList<LogImage>();
    boolean first = true;
    int lastId = 0;
    List<GameHarvest> logEvents = new ArrayList<GameHarvest>();
    while (!cursor.isAfterLast()) {
        int eventId = cursor.getInt(cursor.getColumnIndex(DiaryHelper.COLUMN_LOCALID));
        if (!first && eventId != lastId) {
            cursor.moveToPrevious();
            logEvents.add(createEvent(cursor, logImages));
            logImages = new ArrayList<LogImage>();
            cursor.moveToNext();
        }
        LogImage image = logImageFromCursor(cursor, getDeletedImages);
        if (image != null)
            logImages.add(image);
        lastId = eventId;
        cursor.moveToNext();
        first = false;
    }
    if (cursor.getCount() > 0) {
        cursor.moveToLast();
        logEvents.add(createEvent(cursor, logImages));
    }
    return logEvents;
}
 
Example 12
Project: Orin   File: PlaylistsUtil.java   Source Code and License Vote up 5 votes
public static int createPlaylist(@NonNull final Context context, @Nullable final String name) {
    int id = -1;
    if (name != null && name.length() > 0) {
        try {
            Cursor cursor = context.getContentResolver().query(EXTERNAL_CONTENT_URI,
                    new String[]{MediaStore.Audio.Playlists._ID}, MediaStore.Audio.PlaylistsColumns.NAME + "=?", new String[]{name}, null);
            if (cursor == null || cursor.getCount() < 1) {
                final ContentValues values = new ContentValues(1);
                values.put(MediaStore.Audio.PlaylistsColumns.NAME, name);
                final Uri uri = context.getContentResolver().insert(
                        EXTERNAL_CONTENT_URI,
                        values);
                if (uri != null) {
                    // necessary because somehow the MediaStoreObserver is not notified when adding a playlist
                    context.getContentResolver().notifyChange(Uri.parse("content://media"), null);
                    Toast.makeText(context, context.getResources().getString(
                            R.string.created_playlist_x, name), Toast.LENGTH_SHORT).show();
                    id = Integer.parseInt(uri.getLastPathSegment());
                }
            } else {
                if (cursor.moveToFirst()) {
                    id = cursor.getInt(cursor.getColumnIndex(MediaStore.Audio.Playlists._ID));
                }
            }
            if (cursor != null) {
                cursor.close();
            }
        } catch (SecurityException ignored) {
        }
    }
    if (id == -1) {
        Toast.makeText(context, context.getResources().getString(
                R.string.could_not_create_playlist), Toast.LENGTH_SHORT).show();
    }
    return id;
}
 
Example 13
Project: Shared-Route   File: OrderDao.java   Source Code and License Vote up 5 votes
/**
 * 统计查询  此处查询Country为China的用户总数,***待修改***
 */
public int getItemCount(int sql) {//**//
    int count = 0;

    SQLiteDatabase db = null;
    Cursor cursor = null;

    try {
        db = ordersDBHelper.getReadableDatabase();
        // select count(Id) from Orders where Country = 'China'
        cursor = db.query(OrderDBHelper.TABLE_item,
                new String[]{"COUNT(ID)"},
                "ID = ?",
                new String[]{String.valueOf(sql)},
                null, null, null);

        if (cursor.moveToFirst()) {
            count = cursor.getInt(0);
        }
    }
    catch (Exception e) {
        Log.e(TAG, "", e);
    }
    finally {
        if (cursor != null) {
            cursor.close();
        }
        if (db != null) {
            db.close();
        }
    }

    return count;
}
 
Example 14
Project: letv   File: DownloadTraceHandler.java   Source Code and License Vote up 5 votes
public DownloadDBBean getCurrentDownloadingDBBean() {
    Cursor cursor = null;
    try {
        cursor = this.mContext.getContentResolver().query(LetvContentProvider.URI_DOWNLOADTRACE, null, "finish==", new String[]{"1"}, "timestamp ASC");
        DownloadDBBean downloadDBBean = null;
        while (cursor.moveToNext()) {
            downloadDBBean = new DownloadDBBean();
            downloadDBBean.vid = cursor.getInt(cursor.getColumnIndex("episodeid"));
            downloadDBBean.aid = cursor.getInt(cursor.getColumnIndex(PageJumpUtil.IN_TO_ALBUM_PID));
            downloadDBBean.icon = cursor.getString(cursor.getColumnIndex(SettingsJsonConstants.APP_ICON_KEY));
            downloadDBBean.type = cursor.getInt(cursor.getColumnIndex("type"));
            downloadDBBean.ord = (float) cursor.getInt(cursor.getColumnIndex("ord"));
            downloadDBBean.cid = cursor.getInt(cursor.getColumnIndex("cid"));
            downloadDBBean.episodetitle = cursor.getString(cursor.getColumnIndex("episodetitle"));
            downloadDBBean.episodeIcon = cursor.getString(cursor.getColumnIndex("episodeicon"));
            downloadDBBean.albumtitle = cursor.getString(cursor.getColumnIndex(DownloadAlbumTable.COLUMN_ALBUMTITLE));
            downloadDBBean.totalsize = cursor.getLong(cursor.getColumnIndex(DownloadVideoTable.COLUMN_TOTALSIZE));
            downloadDBBean.finish = cursor.getInt(cursor.getColumnIndex("finish"));
            downloadDBBean.timestamp = cursor.getLong(cursor.getColumnIndex("timestamp"));
            downloadDBBean.length = cursor.getLong(cursor.getColumnIndex(DownloadVideoTable.COLUMN_LENGTH));
            downloadDBBean.filePath = cursor.getString(cursor.getColumnIndex("file_path"));
            downloadDBBean.isHd = cursor.getInt(cursor.getColumnIndex("isHd"));
            downloadDBBean.isNew = cursor.getInt(cursor.getColumnIndex(DownloadVideoTable.COLUMN_ISNEW));
            downloadDBBean.btime = cursor.getLong(cursor.getColumnIndex(DownloadVideoTable.COLUMN_BTIME));
            downloadDBBean.etime = cursor.getLong(cursor.getColumnIndex(DownloadVideoTable.COLUMN_ETIME));
            downloadDBBean.duration = cursor.getLong(cursor.getColumnIndex(DownloadVideoTable.COLUMN_DURATION));
        }
        return downloadDBBean;
    } finally {
        LetvTools.closeCursor(cursor);
    }
}
 
Example 15
Project: app_secompufscar   File: DatabaseHandler.java   Source Code and License Vote up 4 votes
public Atividade getDetalheAtividade(int id) {
    SQLiteDatabase db = this.getReadableDatabase();

    Cursor cursor = db.query(TABLE_ATIVIDADE,
            new String[]{Atividade.TAG_ID,
                    Atividade.TAG_TITULO,
                    Atividade.TAG_PREDIO,
                    Atividade.TAG_SALA,
                    Atividade.TAG_DESCRICAO,
                    Atividade.TAG_HORARIOS,
                    Atividade.TAG_TIPO,
                    Atividade.TAG_ULTIMA_ATUALIZACAO,
                    Atividade.TAG_FAVORITO},
            Atividade.TAG_ID + "=?",
            new String[]{String.valueOf(id)}, null, null, null, null);

    Atividade atividade = new Atividade();

    if (cursor.moveToFirst()) {

        atividade.setId(id);
        atividade.setTitulo(cursor.getString(1));
        atividade.setLocal(cursor.getString(2), cursor.getString(3));
        atividade.setDescricao(cursor.getString(4));
        atividade.setHorarios(cursor.getString(5));
        atividade.setTipo(cursor.getString(6));

        atividade.setHorarioUltimaAtualizacao(cursor.getString(7));

        if (cursor.getInt(8) == 1) {
            atividade.setFavorito(true);
        }
    }

    cursor.close();
    db.close();

    List<Pessoa> ministrantes = getMinistrantes(atividade);
    atividade.setMinistrantes(ministrantes);

    return atividade;
}
 
Example 16
Project: aos-MediaLib   File: TagsFactory.java   Source Code and License Vote up 4 votes
private static int getIntCol(Cursor cur, int id) {
    if(id < 0)
        return -1;
    return cur.getInt(id);
}
 
Example 17
Project: q-mail   File: RecipientLoader.java   Source Code and License Vote up 4 votes
private void fillContactDataFromCursor(Cursor cursor, List<Recipient> recipients,
        Map<String, Recipient> recipientMap, @Nullable String prefilledName) {

    while (cursor.moveToNext()) {
        String name = prefilledName != null ? prefilledName : cursor.getString(INDEX_NAME);

        String email = cursor.getString(INDEX_EMAIL);
        long contactId = cursor.getLong(INDEX_CONTACT_ID);
        String lookupKey = cursor.getString(INDEX_LOOKUP_KEY);

        // already exists? just skip then
        if (recipientMap.containsKey(email)) {
            // TODO merge? do something else? what do we do?
            continue;
        }

        int addressType = cursor.getInt(INDEX_EMAIL_TYPE);
        String addressLabel = null;
        switch (addressType) {
            case ContactsContract.CommonDataKinds.Email.TYPE_HOME: {
                addressLabel = getContext().getString(R.string.address_type_home);
                break;
            }
            case ContactsContract.CommonDataKinds.Email.TYPE_WORK: {
                addressLabel = getContext().getString(R.string.address_type_work);
                break;
            }
            case ContactsContract.CommonDataKinds.Email.TYPE_OTHER: {
                addressLabel = getContext().getString(R.string.address_type_other);
                break;
            }
            case ContactsContract.CommonDataKinds.Email.TYPE_MOBILE: {
                // mobile isn't listed as an option contacts app, but it has a constant so we better support it
                addressLabel = getContext().getString(R.string.address_type_mobile);
                break;
            }
            case ContactsContract.CommonDataKinds.Email.TYPE_CUSTOM: {
                addressLabel = cursor.getString(INDEX_EMAIL_CUSTOM_LABEL);
                break;
            }
        }

        Recipient recipient = new Recipient(name, email, addressLabel, contactId, lookupKey);
        if (recipient.isValidEmailAddress()) {
            Uri photoUri = cursor.isNull(INDEX_PHOTO_URI) ? null : Uri.parse(cursor.getString(INDEX_PHOTO_URI));

            recipient.photoThumbnailUri = photoUri;
            recipientMap.put(email, recipient);
            recipients.add(recipient);
        }
    }

    cursor.close();
}
 
Example 18
Project: AIMSICDL   File: MapFragment.java   Source Code and License Vote up 4 votes
private void loadOcidMarkersByNetwork() {
    // Check if OpenCellID data exists and if so load this now
    List<CellTowerMarker> items = new LinkedList<>();
    String networkOperator = tm.getNetworkOperator();
    int currentMmc = 0;
    int currentMnc = 0;
    if (networkOperator != null && networkOperator.length() > 3) {
        currentMmc = Integer.parseInt(networkOperator.substring(0, 3));
        currentMnc = Integer.parseInt(networkOperator.substring(3));
    }
    // DBe_import tower pins.
    //Drawable cellTowerMarkerIcon = getResources().getDrawable(R.drawable.ic_map_pin_green);
    Drawable cellTowerMarkerIcon = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_map_pin_green, null);

    Cursor c = mDbHelper.returnOcidBtsByNetwork(currentMmc, currentMnc);
    if (c.moveToFirst()) {
        do {
            // CellID,Lac,Mcc,Mnc,Lat,Lng,AvgSigStr,Samples
            final int cellID = c.getInt(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_CID));
            final int lac = c.getInt(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_LAC));
            final int mcc = c.getInt(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_MCC));
            final int mnc = c.getInt(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_MNC));
            final int psc = c.getInt(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_PSC));
            final String rat = c.getString(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_RAT));
            final double dLat = Double.parseDouble(c.getString(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_GPS_LAT)));
            final double dLng = Double.parseDouble(c.getString(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_GPS_LON)));
            final GeoPoint location = new GeoPoint(dLat, dLng);
            //where is c.getString(6)AvgSigStr
            final int samples = c.getInt(c.getColumnIndex(DBTableColumnIds.DBE_IMPORT_SAMPLES));
            // Add map marker for CellID
            CellTowerMarker ovm = new CellTowerMarker(getActivity(), mMap,
                    "Cell ID: " + cellID,
                    "", location,
                    new MarkerData(
                            getContext(),
                            String.valueOf(cellID),
                            String.valueOf(location.getLatitude()),
                            String.valueOf(location.getLongitude()),
                            String.valueOf(lac),
                            String.valueOf(mcc),
                            String.valueOf(mnc),
                            String.valueOf(psc),
                            rat,
                            String.valueOf(samples),
                            false));

            ovm.setIcon(cellTowerMarkerIcon);
            items.add(ovm);
        } while (c.moveToNext());
    }
    c.close();

    mCellTowerGridMarkerClusterer.addAll(items);
}
 
Example 19
Project: KingTV   File: LiveInfoDao.java   Source Code and License Vote up 4 votes
@Override
public LiveInfo readEntity(Cursor cursor, int offset) {
    LiveInfo entity = new LiveInfo( //
        cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // no
        cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // nick
        cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // avatar
        cursor.getInt(offset + 3), // follow
        cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // id
        cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // uid
        cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // title
        cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // category_id
        cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // slug
        cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // intro
        cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // announcement
        cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cover
        cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // play_at
        cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // last_play_at
        cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // view
        cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // status
        cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // priv
        cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // landscape
        cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // position
        cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // weight
        cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // check
        cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // recommend_image
        cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // videoQuality
        cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // category_name
        cursor.getInt(offset + 24), // screen
        cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // start_time
        cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // stream
        cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // thumb
        cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // video
        cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // app_shuffling_image
        cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // categoryId
        cursor.getShort(offset + 31) != 0, // hidden
        cursor.getShort(offset + 32) != 0, // play_status
        cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33), // icontext
        cursor.isNull(offset + 34) ? null : cursor.getString(offset + 34), // category_slug
        cursor.isNull(offset + 35) ? null : cursor.getString(offset + 35) // love_conver
    );
    return entity;
}
 
Example 20
Project: PeSanKita-android   File: ContactSelectionListAdapter.java   Source Code and License Vote up 4 votes
private boolean isPush(int position) {
  final Cursor cursor = getCursorAtPositionOrThrow(position);
  return cursor.getInt(cursor.getColumnIndexOrThrow(ContactsDatabase.CONTACT_TYPE_COLUMN)) == ContactsDatabase.PUSH_TYPE;
}