Android sqlite cursor的遍历

查询并获得了cursor对象后,用while(corsor.moveToNext()){}遍历,当corsor.moveToNext()方法调用,如果发现没有对象,会返回false

Android sqlite cursor的遍历
    public List<MMImage> getAll() {
        List<MMImage> list = new ArrayList<MMImage>();
        Cursor c = null;
        try {
            c = database.query(TABLE, null, null, null, null, null, null);
            while (c.moveToNext()) {
                MMImage mmImage = getMMImageFromCursor(c);
                list.add(mmImage);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (c != null) {
                c.close();
            }
        }
        return list;
    }
Android sqlite cursor的遍历

 

Android sqlite cursor的遍历,布布扣,bubuko.com

Android sqlite cursor的遍历

上一篇:Android 监听ListView、GridView滑动到底部


下一篇:牛掰本机限速软件appband