首页 > 其他 > 详细

Cursor 游标

时间:2015-06-06 16:18:36      阅读:329      评论:0      收藏:0      [点我收藏+]

private void printCursor(Cursor cursor) {
  if(cursor != null && cursor.getCount() > 0) {
   
   while(cursor.moveToNext()) {
    
    int columnCount = cursor.getColumnCount(); // 列的总数
    
    for (int i = 0; i < columnCount; i++) {
     String columnName = cursor.getColumnName(i); // 取对应i位置的列的名称
     String columnValue = cursor.getString(i); // 取出对应i位置的列的值
     
     Log.i(TAG, "当前是第" + cursor.getPosition() + "行: " + columnName + " = " + columnValue);
    }
   }
   cursor.close();
  }
 }

Cursor 游标

原文:http://www.cnblogs.com/hanxing/p/4556698.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!