當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。