为什么方法返回空对象?

时间:2019-12-30 11:42:07

标签: java android

我有一个名为FindWord()的方法,但它返回空对象。我的错在哪里?

public Word FindWord( String kelime, SQLiteDatabase db){

        Word w= new Word();
        Cursor c = db.rawQuery("SELECT * FROM Words WHERE Name = ?", new String[] {kelime});

            if (c.moveToNext()){
                w = new Word(c.getInt(c.getColumnIndex("Id"))
                        ,c.getString(c.getColumnIndex("Name"))
                        ,c.getString(c.getColumnIndex("Mean")));
            }
            return w;
    }

0 个答案:

没有答案