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


Java Cursor.move方法代码示例

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


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

示例1: buildHistoryItem

import android.database.Cursor; //导入方法依赖的package包/类
public HistoryItem buildHistoryItem(int number) {
  SQLiteOpenHelper helper = new DBHelper(activity);
  SQLiteDatabase db = null;
  Cursor cursor = null;
  try {
    db = helper.getReadableDatabase();
    cursor = db.query(DBHelper.TABLE_NAME, COLUMNS, null, null, null, null, DBHelper.TIMESTAMP_COL + " DESC");
    cursor.move(number + 1);
    String text = cursor.getString(0);
    String display = cursor.getString(1);
    String format = cursor.getString(2);
    long timestamp = cursor.getLong(3);
    String details = cursor.getString(4);
    Result result = new Result(text, null, null, BarcodeFormat.valueOf(format), timestamp);
    return new HistoryItem(result, display, details);
  } finally {
    close(cursor, db);
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:20,代码来源:HistoryManager.java

示例2: deleteHistoryItem

import android.database.Cursor; //导入方法依赖的package包/类
public void deleteHistoryItem(int number) {
  SQLiteOpenHelper helper = new DBHelper(activity);
  SQLiteDatabase db = null;
  Cursor cursor = null;
  try {
    db = helper.getWritableDatabase();      
    cursor = db.query(DBHelper.TABLE_NAME,
                      ID_COL_PROJECTION,
                      null, null, null, null,
                      DBHelper.TIMESTAMP_COL + " DESC");
    cursor.move(number + 1);
    db.delete(DBHelper.TABLE_NAME, DBHelper.ID_COL + '=' + cursor.getString(0), null);
  } finally {
    close(cursor, db);
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:17,代码来源:HistoryManager.java

示例3: trimHistory

import android.database.Cursor; //导入方法依赖的package包/类
public void trimHistory() {
  SQLiteOpenHelper helper = new DBHelper(activity);
  SQLiteDatabase db = null;
  Cursor cursor = null;
  try {
    db = helper.getWritableDatabase();      
    cursor = db.query(DBHelper.TABLE_NAME,
                      ID_COL_PROJECTION,
                      null, null, null, null,
                      DBHelper.TIMESTAMP_COL + " DESC");
    cursor.move(MAX_ITEMS);
    while (cursor.moveToNext()) {
      String id = cursor.getString(0);
      Log.i(TAG, "Deleting scan history ID " + id);
      db.delete(DBHelper.TABLE_NAME, DBHelper.ID_COL + '=' + id, null);
    }
  } catch (SQLiteException sqle) {
    // We're seeing an error here when called in CaptureActivity.onCreate() in rare cases
    // and don't understand it. First theory is that it's transient so can be safely ignored.
    Log.w(TAG, sqle);
    // continue
  } finally {
    close(cursor, db);
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:26,代码来源:HistoryManager.java

示例4: getDownloadDBBeanPosition

import android.database.Cursor; //导入方法依赖的package包/类
public DownloadDBBean getDownloadDBBeanPosition(int position) {
    DownloadDBBean mDownloadDBBean = null;
    try {
        Cursor cursor = this.context.getContentResolver().query(LetvContentProvider.URI_WORLDCUPTRACE, null, "finish<>?", new String[]{"4"}, "timestamp ASC");
        if (cursor.move(position + 1)) {
            mDownloadDBBean = createDownloadDBBean(cursor);
        }
        LetvTools.closeCursor(cursor);
        return mDownloadDBBean;
    } catch (Throwable th) {
        LetvTools.closeCursor(null);
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:14,代码来源:WorldCupTraceHandler.java

示例5: getDownloadDBBeanPosition

import android.database.Cursor; //导入方法依赖的package包/类
public DownloadDBBean getDownloadDBBeanPosition(int position) {
    Throwable th;
    Cursor cursor = null;
    DownloadDBBean mDownloadDBBean = null;
    try {
        cursor = this.mContext.getContentResolver().query(LetvContentProvider.URI_DOWNLOADTRACE, null, "finish<>?", new String[]{"4"}, "timestamp ASC");
        if (cursor.move(position + 1)) {
            DownloadDBBean mDownloadDBBean2 = new DownloadDBBean();
            try {
                mDownloadDBBean2.vid = cursor.getInt(cursor.getColumnIndex("episodeid"));
                mDownloadDBBean2.aid = cursor.getInt(cursor.getColumnIndex(PageJumpUtil.IN_TO_ALBUM_PID));
                mDownloadDBBean2.icon = cursor.getString(cursor.getColumnIndex(SettingsJsonConstants.APP_ICON_KEY));
                mDownloadDBBean2.type = cursor.getInt(cursor.getColumnIndex("type"));
                mDownloadDBBean2.ord = (float) cursor.getInt(cursor.getColumnIndex("ord"));
                mDownloadDBBean2.cid = cursor.getInt(cursor.getColumnIndex("cid"));
                mDownloadDBBean2.episodetitle = cursor.getString(cursor.getColumnIndex("episodetitle"));
                mDownloadDBBean2.episodeIcon = cursor.getString(cursor.getColumnIndex("episodeicon"));
                mDownloadDBBean2.albumtitle = cursor.getString(cursor.getColumnIndex(DownloadAlbumTable.COLUMN_ALBUMTITLE));
                mDownloadDBBean2.totalsize = cursor.getLong(cursor.getColumnIndex(DownloadVideoTable.COLUMN_TOTALSIZE));
                mDownloadDBBean2.finish = cursor.getInt(cursor.getColumnIndex("finish"));
                mDownloadDBBean2.timestamp = cursor.getLong(cursor.getColumnIndex("timestamp"));
                mDownloadDBBean2.length = cursor.getLong(cursor.getColumnIndex(DownloadVideoTable.COLUMN_LENGTH));
                mDownloadDBBean2.filePath = cursor.getString(cursor.getColumnIndex("file_path"));
                mDownloadDBBean2.isHd = cursor.getInt(cursor.getColumnIndex("isHd"));
                mDownloadDBBean2.isNew = cursor.getInt(cursor.getColumnIndex(DownloadVideoTable.COLUMN_ISNEW));
                mDownloadDBBean2.btime = cursor.getLong(cursor.getColumnIndex(DownloadVideoTable.COLUMN_BTIME));
                mDownloadDBBean2.etime = cursor.getLong(cursor.getColumnIndex(DownloadVideoTable.COLUMN_ETIME));
                mDownloadDBBean = mDownloadDBBean2;
            } catch (Throwable th2) {
                th = th2;
                mDownloadDBBean = mDownloadDBBean2;
                LetvTools.closeCursor(cursor);
                throw th;
            }
        }
        LetvTools.closeCursor(cursor);
        return mDownloadDBBean;
    } catch (Throwable th3) {
        th = th3;
        LetvTools.closeCursor(cursor);
        throw th;
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:44,代码来源:DownloadTraceHandler.java


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