Android:游标为空甚至返回一个值

时间:2015-09-03 06:52:44

标签: android

我想在我的Sq-lite表中检查记录是否可用。我试过但是光标始终返回 1 值,即使SQlite数据库表为空,也没有任何记录table.Why返回一个?怎么解决这个问题?谢谢你提前。

public static void cloneCell(XWPFTableCell clone, XWPFTableCell source) {
    CTTcPr cttcPr = clone.getCTTc().isSetTcPr() ? clone.getCTTc().getTcPr() : clone.getCTTc().addNewTcPr();
    cttcPr.set(source.getCTTc().getTcPr());

    int indexParag = 0, indexTable = 0;
    for (IBodyElement iBodyElement : source.getBodyElements()) {
        BodyElementType beType = iBodyElement.getElementType();
        if (beType == BodyElementType.PARAGRAPH) {
            XWPFParagraph sourceParag = (XWPFParagraph)iBodyElement;
            XWPFParagraph cloneParag = indexParag < clone.getParagraphs().size() ? clone.getParagraphs().get(indexParag) : clone.addParagraph();
            cloneParagraph(cloneParag, sourceParag);
            indexParag++;
        } else if (beType == BodyElementType.TABLE) {
            XWPFTable sourceTable = (XWPFTable)iBodyElement;
            XWPFTable cloneTable = indexTable < clone.getTables().size() ? clone.getTables().get(indexTable) : clone.insertNewTbl(sourceTable.getCTTbl().newCursor());
            if (cloneTable == null)
                cloneTable = new XWPFTable(clone.getCTTc().addNewTbl(), clone);

            cloneTable(cloneTable, sourceTable);
            indexTable++;
        }
    }
}

1 个答案:

答案 0 :(得分:0)

使用mcursor.getCount()检查行数