Android将listview的位置值传递给DATABASE HELPER进行查询

时间:2015-11-14 20:38:33

标签: android database sqlite listview android-intent

我想打开新活动,该活动将显示listview的位置ID中的说明。 这是我的帮手

public List<step_con> getSteps(){
    List<step_con> steplist = new ArrayList<step_con>();

    String query = "SELECT s1,s1_img,s2,s2_img,s3,s3_img,s4,s4_img,s5,s5_img,s6,s6_img, FROM step_software WHERE _id = "+ id;

    Cursor cur = database.rawQuery(query, null);
    if (cur.moveToFirst()) {

        do {
            step_con steps = new step_con();

            steps.setS(cur.getString(0));
            steps.setImage(cur.getBlob(1));
            steps.setS2(cur.getString(2));
            steps.setImage2(cur.getBlob(3));
            steps.setS3(cur.getString(4));
            steps.setImage3(cur.getBlob(5));
            steps.setS4(cur.getString(6));
            steps.setImage4(cur.getBlob(7));
            steps.setS5(cur.getString(8));
            steps.setImage5(cur.getBlob(9));
            steps.setS6(cur.getString(10));
            steps.setImage6(cur.getBlob(11));
        } while (cur.moveToNext());
    }
    database.close();

    return steplist;
}

+ id是mylistview的位置。

这是我的listitemclick

    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Intent myIntent = new Intent(view.getContext(),DatabaseAccess.class);

    int pos = position;
    String pos1 = String.valueOf(pos);

}

我是初学者,没有上课,只是自学。请帮忙我应该做什么或包括什么?

0 个答案:

没有答案