sqlite Android-如何获取特定列/行的值

sqlite Android-如何获取特定列/行的值,android,sqlite,Android,Sqlite,我有一个方法,我将id传递给该方法,然后希望在该表中找到与该id匹配的行,并返回一个作为该行协作对象的字符串: public String getIconLabel(int id){ String label; String selectQuery = "SELECT "+colL" FROM " + allIcons + " WHERE " +colIconID + "="+id; SQLiteDatabase db = this.getRe

我有一个方法,我将id传递给该方法,然后希望在该表中找到与该id匹配的行,并返回一个作为该行协作对象的字符串:

public String getIconLabel(int id){
        String label;
        String selectQuery = "SELECT "+colL" FROM " + allIcons + " WHERE " +colIconID + "="+id; 

        SQLiteDatabase db = this.getReadableDatabase();
        Cursor cursor = db.rawQuery(selectQuery, null);

        label = //HELP

        return label;

    }
我不清楚如何将标签设置为所选行的特定列

请帮忙

if (null != cursor && cursor.moveToFirst()) {
    label = cursor.getString(cursor.getColumnIndex(COLUMN_ID));
}
0参数表示您的列索引。参考这个

if(cursor != null)
{
cursor.moveToFirst();
String label = cursor.getString(0);
}