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


Java Cursor.isLast方法代码示例

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


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

示例1: loadDeep

import android.database.Cursor; //导入方法依赖的package包/类
public BThread loadDeep(Long key) {
    assertSinglePk();
    if (key == null) {
        return null;
    }

    StringBuilder builder = new StringBuilder(getSelectDeep());
    builder.append("WHERE ");
    SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
    String sql = builder.toString();
    
    String[] keyArray = new String[] { key.toString() };
    Cursor cursor = db.rawQuery(sql, keyArray);
    
    try {
        boolean available = cursor.moveToFirst();
        if (!available) {
            return null;
        } else if (!cursor.isLast()) {
            throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
        }
        return loadCurrentDeep(cursor, true);
    } finally {
        cursor.close();
    }
}
 
开发者ID:MobileDev418,项目名称:chat-sdk-android-push-firebase,代码行数:27,代码来源:BThreadDao.java

示例2: buildAlbumInfo

import android.database.Cursor; //导入方法依赖的package包/类
private void buildAlbumInfo(ContentResolver cr) {
    String[] distinctBucketColumns = new String[]{Media.BUCKET_ID, Media.BUCKET_DISPLAY_NAME};
    Cursor bucketCursor = null;
    try {
        bucketCursor = cr.query(Media.EXTERNAL_CONTENT_URI, distinctBucketColumns, "0==0)" + " GROUP BY(" + Media.BUCKET_ID, null,
                Media.DATE_MODIFIED + " desc");
        if (bucketCursor != null && bucketCursor.moveToFirst()) {
            do {
                String buckId = bucketCursor.getString(bucketCursor.getColumnIndex(Media.BUCKET_ID));
                String name = bucketCursor.getString(bucketCursor.getColumnIndex(Media.BUCKET_DISPLAY_NAME));
                AlbumEntity album = buildAlbumInfo(name, buckId);
                if (!TextUtils.isEmpty(buckId)) {
                    buildAlbumCover(cr, buckId, album);
                }
            } while (bucketCursor.moveToNext() && !bucketCursor.isLast());
        }
    } finally {
        if (bucketCursor != null) {
            bucketCursor.close();
        }
    }
}
 
开发者ID:devzwy,项目名称:NeiHanDuanZiTV,代码行数:23,代码来源:AlbumTask.java

示例3: loadDeep

import android.database.Cursor; //导入方法依赖的package包/类
public UserThreadLink loadDeep(Long key) {
    assertSinglePk();
    if (key == null) {
        return null;
    }

    StringBuilder builder = new StringBuilder(getSelectDeep());
    builder.append("WHERE ");
    SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
    String sql = builder.toString();
    
    String[] keyArray = new String[] { key.toString() };
    Cursor cursor = db.rawQuery(sql, keyArray);
    
    try {
        boolean available = cursor.moveToFirst();
        if (!available) {
            return null;
        } else if (!cursor.isLast()) {
            throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
        }
        return loadCurrentDeep(cursor, true);
    } finally {
        cursor.close();
    }
}
 
开发者ID:MobileDev418,项目名称:chat-sdk-android-push-firebase,代码行数:27,代码来源:UserThreadLinkDao.java

示例4: loadDeep

import android.database.Cursor; //导入方法依赖的package包/类
public UsedProduct loadDeep(Long key) {
    assertSinglePk();
    if (key == null) {
        return null;
    }

    StringBuilder builder = new StringBuilder(getSelectDeep());
    builder.append("WHERE ");
    SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
    String sql = builder.toString();
    
    String[] keyArray = new String[] { key.toString() };
    Cursor cursor = db.rawQuery(sql, keyArray);
    
    try {
        boolean available = cursor.moveToFirst();
        if (!available) {
            return null;
        } else if (!cursor.isLast()) {
            throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
        }
        return loadCurrentDeep(cursor, true);
    } finally {
        cursor.close();
    }
}
 
开发者ID:Lidchanin,项目名称:Shopping_List,代码行数:27,代码来源:UsedProductDao.java

示例5: refresh

import android.database.Cursor; //导入方法依赖的package包/类
/** Resets all locally changed properties of the entity by reloading the values from the database. */
public void refresh(T entity) {
    assertSinglePk();
    K key = getKeyVerified(entity);
    String sql = statements.getSelectByKey();
    String[] keyArray = new String[]{key.toString()};
    Cursor cursor = db.rawQuery(sql, keyArray);
    try {
        boolean available = cursor.moveToFirst();
        if (!available) {
            throw new DaoException("Entity does not exist in the database anymore: " + entity.getClass()
                    + " with key " + key);
        } else if (!cursor.isLast()) {
            throw new DaoException("Expected unique result, but count was " + cursor.getCount());
        }
        readEntity(cursor, entity, 0);
        attachEntity(key, entity, true);
    } finally {
        cursor.close();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:AbstractDao.java

示例6: count

import android.database.Cursor; //导入方法依赖的package包/类
/** Returns the count (number of results matching the query). Uses SELECT COUNT (*) sematics. */
public long count() {
    checkThread();
    Cursor cursor = dao.getDatabase().rawQuery(sql, parameters);
    try {
        if (!cursor.moveToNext()) {
            throw new DaoException("No result for count");
        } else if (!cursor.isLast()) {
            throw new DaoException("Unexpected row count: " + cursor.getCount());
        } else if (cursor.getColumnCount() != 1) {
            throw new DaoException("Unexpected column count: " + cursor.getColumnCount());
        }
        return cursor.getLong(0);
    } finally {
        cursor.close();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:CountQuery.java

示例7: loadDeep

import android.database.Cursor; //导入方法依赖的package包/类
public TreeEntity loadDeep(Long key) {
    assertSinglePk();
    if (key == null) {
        return null;
    }

    StringBuilder builder = new StringBuilder(getSelectDeep());
    builder.append("WHERE ");
    SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
    String sql = builder.toString();
    
    String[] keyArray = new String[] { key.toString() };
    Cursor cursor = db.rawQuery(sql, keyArray);
    
    try {
        boolean available = cursor.moveToFirst();
        if (!available) {
            return null;
        } else if (!cursor.isLast()) {
            throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
        }
        return loadCurrentDeep(cursor, true);
    } finally {
        cursor.close();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:TreeEntityDao.java

示例8: loadDeep

import android.database.Cursor; //导入方法依赖的package包/类
public RelationEntity loadDeep(Long key) {
    assertSinglePk();
    if (key == null) {
        return null;
    }

    StringBuilder builder = new StringBuilder(getSelectDeep());
    builder.append("WHERE ");
    SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
    String sql = builder.toString();
    
    String[] keyArray = new String[] { key.toString() };
    Cursor cursor = db.rawQuery(sql, keyArray);
    
    try {
        boolean available = cursor.moveToFirst();
        if (!available) {
            return null;
        } else if (!cursor.isLast()) {
            throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
        }
        return loadCurrentDeep(cursor, true);
    } finally {
        cursor.close();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:RelationEntityDao.java

示例9: loadDeep

import android.database.Cursor; //导入方法依赖的package包/类
public BMessage loadDeep(Long key) {
    assertSinglePk();
    if (key == null) {
        return null;
    }

    StringBuilder builder = new StringBuilder(getSelectDeep());
    builder.append("WHERE ");
    SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
    String sql = builder.toString();
    
    String[] keyArray = new String[] { key.toString() };
    Cursor cursor = db.rawQuery(sql, keyArray);
    
    try {
        boolean available = cursor.moveToFirst();
        if (!available) {
            return null;
        } else if (!cursor.isLast()) {
            throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
        }
        return loadCurrentDeep(cursor, true);
    } finally {
        cursor.close();
    }
}
 
开发者ID:MobileDev418,项目名称:chat-sdk-android-push-firebase,代码行数:27,代码来源:BMessageDao.java

示例10: loadDeep

import android.database.Cursor; //导入方法依赖的package包/类
public BLinkedAccount loadDeep(Long key) {
    assertSinglePk();
    if (key == null) {
        return null;
    }

    StringBuilder builder = new StringBuilder(getSelectDeep());
    builder.append("WHERE ");
    SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
    String sql = builder.toString();
    
    String[] keyArray = new String[] { key.toString() };
    Cursor cursor = db.rawQuery(sql, keyArray);
    
    try {
        boolean available = cursor.moveToFirst();
        if (!available) {
            return null;
        } else if (!cursor.isLast()) {
            throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
        }
        return loadCurrentDeep(cursor, true);
    } finally {
        cursor.close();
    }
}
 
开发者ID:MobileDev418,项目名称:chat-sdk-android-push-firebase,代码行数:27,代码来源:BLinkedAccountDao.java

示例11: loadDeep

import android.database.Cursor; //导入方法依赖的package包/类
public ContactLink loadDeep(Long key) {
    assertSinglePk();
    if (key == null) {
        return null;
    }

    StringBuilder builder = new StringBuilder(getSelectDeep());
    builder.append("WHERE ");
    SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
    String sql = builder.toString();
    
    String[] keyArray = new String[] { key.toString() };
    Cursor cursor = db.rawQuery(sql, keyArray);
    
    try {
        boolean available = cursor.moveToFirst();
        if (!available) {
            return null;
        } else if (!cursor.isLast()) {
            throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
        }
        return loadCurrentDeep(cursor, true);
    } finally {
        cursor.close();
    }
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:27,代码来源:ContactLinkDao.java

示例12: loadDeep

import android.database.Cursor; //导入方法依赖的package包/类
public FollowerLink loadDeep(Long key) {
    assertSinglePk();
    if (key == null) {
        return null;
    }

    StringBuilder builder = new StringBuilder(getSelectDeep());
    builder.append("WHERE ");
    SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
    String sql = builder.toString();
    
    String[] keyArray = new String[] { key.toString() };
    Cursor cursor = db.rawQuery(sql, keyArray);
    
    try {
        boolean available = cursor.moveToFirst();
        if (!available) {
            return null;
        } else if (!cursor.isLast()) {
            throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
        }
        return loadCurrentDeep(cursor, true);
    } finally {
        cursor.close();
    }
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:27,代码来源:FollowerLinkDao.java

示例13: addItem

import android.database.Cursor; //导入方法依赖的package包/类
private void addItem(final int allCount, final List<ImageMedia> result, Cursor cursor, @NonNull final IMediaTaskCallback<ImageMedia> callback) {
    if (cursor != null && cursor.moveToFirst()) {
        do {
            String picPath = cursor.getString(cursor.getColumnIndex(Images.Media.DATA));
            if (callback.needFilter(picPath)) {
                BoxingLog.d("path:" + picPath + " has been filter");
            } else {
                String id = cursor.getString(cursor.getColumnIndex(Images.Media._ID));
                String size = cursor.getString(cursor.getColumnIndex(Images.Media.SIZE));
                String mimeType = cursor.getString(cursor.getColumnIndex(Images.Media.MIME_TYPE));
                int width = 0;
                int height = 0;
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                    width = cursor.getInt(cursor.getColumnIndex(Images.Media.WIDTH));
                    height = cursor.getInt(cursor.getColumnIndex(Images.Media.HEIGHT));
                }
                ImageMedia imageItem = new ImageMedia.Builder(id, picPath).setThumbnailPath(mThumbnailMap.get(id))
                        .setSize(size).setMimeType(mimeType).setHeight(height).setWidth(width).build();
                if (!result.contains(imageItem)) {
                    result.add(imageItem);
                }
            }
        } while (!cursor.isLast() && cursor.moveToNext());
        postMedias(result, allCount, callback);
    } else {
        postMedias(result, 0, callback);
    }
    clear();
}
 
开发者ID:devzwy,项目名称:NeiHanDuanZiTV,代码行数:30,代码来源:ImageTask.java

示例14: loadVideos

import android.database.Cursor; //导入方法依赖的package包/类
private void loadVideos(ContentResolver cr, int page, @NonNull final IMediaTaskCallback<VideoMedia> callback) {
    final List<VideoMedia> videoMedias = new ArrayList<>();
    final Cursor cursor = cr.query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, MEDIA_COL, null, null,
            MediaStore.Images.Media.DATE_MODIFIED + " desc" + " LIMIT " + page * IMediaTask.PAGE_LIMIT + " , " + IMediaTask.PAGE_LIMIT);
    try {
        int count = 0;
        if (cursor != null && cursor.moveToFirst()) {
            count = cursor.getCount();
            do {
                String data = cursor.getString(cursor.getColumnIndex(MediaStore.Video.Media.DATA));
                String id = cursor.getString(cursor.getColumnIndex(MediaStore.Video.Media._ID));
                String title = cursor.getString(cursor.getColumnIndex(MediaStore.Video.Media.TITLE));
                String type = cursor.getString(cursor.getColumnIndex(MediaStore.Video.Media.MIME_TYPE));
                String size = cursor.getString(cursor.getColumnIndex(MediaStore.Video.Media.SIZE));
                String date = cursor.getString(cursor.getColumnIndex(MediaStore.Video.Media.DATE_TAKEN));
                String duration = cursor.getString(cursor.getColumnIndex(MediaStore.Video.Media.DURATION));
                VideoMedia video = new VideoMedia.Builder(id, data).setTitle(title).setDuration(duration)
                        .setSize(size).setDataTaken(date).setMimeType(type).build();
                videoMedias.add(video);

            } while (!cursor.isLast() && cursor.moveToNext());
            postMedias(callback, videoMedias, count);
        } else {
            postMedias(callback, videoMedias, 0);
        }
    } finally {
        if (cursor != null) {
            cursor.close();
        }
    }

}
 
开发者ID:Bilibili,项目名称:boxing,代码行数:33,代码来源:VideoTask.java

示例15: onActivityResult

import android.database.Cursor; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // check whether the result is ok
    if (resultCode == RESULT_OK) {
        // Check for the request code, we might be usign multiple startActivityForReslut
        switch (requestCode) {
            case RESULT_PICK_CONTACT:
                Uri uri = data.getData();
                Cursor cursor = getContentResolver().query(uri, null, null, null, null);
                cursor.moveToFirst();
                String number = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
                number = number.replace("-", "");
                number = number.replace(" ", "");
                while(number.length() != 6 && !cursor.isLast()){
                    cursor.moveToNext();
                    number = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
                    number = number.replace("-", "");
                    number = number.replace(" ", "");
                }
                if (number.length() != 6){
                    Toast.makeText(this, "No valid RTVOICE number was found for selected contact", Toast.LENGTH_LONG).show();
                    break;
                }
                final EditText numberTextView = (EditText) findViewById(R.id.editText);
                numberTextView.setText(number);
                break;
        }
    } else {
        Log.e("MainActivity", "Failed to pick contact");
    }
}
 
开发者ID:rctl,项目名称:CryptoVoice,代码行数:32,代码来源:Main.java


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