0

这是我的数据库助手(我需要在 KEY_NAME = 时选择 KEY_LOCATION ?)

public nranges getCafego(String cafesname) {
    DataAccessClass dataAcessClass = new DataAccessClass(con);
        SQLiteDatabase db = dataAcessClass.getReadableDatabase();

        Cursor cursor = db.query(TABLE_NAME, new String[] { KEY_ID,
                KEY_NAME, KEY_LOCATION },
            KEY_NAME + "=?", new String[] { String.valueOf(cafesname) }, null, null,
                null, null);
        if (cursor != null)
            cursor.moveToFirst();
        nranges rng = new nranges();
        rng.setId(Integer.parseInt(cursor.getString(cursor
                .getColumnIndex(KEY_ID))));
        rng.setName(cursor.getString(cursor
            .getColumnIndex(KEY_NAME)));
        rng.setLocation(cursor.getString(cursor
                .getColumnIndex(KEY_LOCATION)));

    // return Note
        return rng;
    }

这是我的活动,我需要将 KEY_LOCATION 作为字符串并在 textview 中提供

Intent i=getIntent();
String MyCafeName =i.getExtras().getString("MyCafeName");

    txtcafename.setText(MyCafeName);
    nrangehelper bud3=new nrangehelper(cafelistselected.this); //  my database helper which name is (nrangehelper)
    bud3.getCafego(MyCafeName); //Mycafename is the name of cafe which i need to select to get its location 
    // what to do next?????
4

0 回答 0