以前に入力されたsqliteデータベースからクエリを使用してデータを取得しようとしています。しかし、何らかの理由で、returnscursor行のないクエリ。
だからここに私がデータを取得しようとした部分があります:
        database.open();
    Cursor cursor = database.getComponentData("CONTROLS", null, null);
    int test = cursor.getCount();//This is the part where i test through the eclipse debugger whether there is  any rows return
    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {
        get.append("Video controls : "+cursor.getString(1)+" Audio Controls : "+cursor.getString(2)+" Reader controls : "+cursor.getString(3));
        cursor.moveToNext();
    }
    cursor.close();
    Cursor cursor1 = database.getComponentData("LIST", new String[]{"'URL'"},"AUDIO");
    get.append("Video list : ");
        cursor1.moveToFirst();
    while (!cursor1.isAfterLast()) {
        get.append(" "+cursor1.getString(1)+" "+cursor1.getString(2)+" "+cursor1.getString(3));
        cursor1.moveToNext();
    }
    cursor1.close();
    database.close();
そして、これが私が照会したデータベースアダプタの部分です。
public Cursor getComponentData(String whichTable,String[] whichColumn,String whichSection) {
    Cursor c = null;
    if(whichSection!=null) 
    {   
        return database.query(whichTable, whichColumn,"SECTION = '"+whichSection+"'",null, null, null, null);
    }
    else{
        return database.query(whichTable, whichColumn,null,null, null, null, null);
    }
}
これは、以前にデータベースに挿入した部分です。
                 database.open();
               ContentValues control = new ContentValues();
               control.put("VIDEO_CONTROLS",video_control);
               control.put("AUDIO_CONTROLS",audio_control);
               control.put("READER_CONTROLS",book_control);
               control_long =database.insertNewControl(control);
               ContentValues temp_list = new ContentValues();
                a_p=audio_playlist.split(",");
                v_p=video_playlist.split(",");
                b_p=booklist.split(",");
               for(int i =0;i<a_p.length;i++){
                   temp_list.put("NAME", "test");
                   temp_list.put("URL", a_p[i]);
                   temp_list.put("SECTION", "AUDIO");
                list_long=   database.insertNewListRow(temp_list);
               }
               for(int i =0;i<v_p.length;i++){
                  temp_list.put("NAME", "test");
                   temp_list.put("URL", v_p[i]);
                   temp_list.put("SECTION", "VIDEO");
                   list_long=    database.insertNewListRow(temp_list);
                   }
               for(int i =0;i<b_p.length;i++){
                 temp_list.put("NAME", "test");
                   temp_list.put("URL", b_p[i]);
                   temp_list.put("SECTION", "READER");
                   list_long=   database.insertNewListRow(temp_list);
                   }
                database.close();
アダプタにメソッドを挿入します。
    public Long insertNewControl(ContentValues controls_values) {
return database.insert("CONTROLS", null, controls_values);  
}
public Long insertNewListRow(ContentValues list_values){
return database.insert("LIST", null, list_values);  
}
読んでくれてありがとう。
編集:
これについて言及するのを忘れた、query()これらの行を挿入した直後にデータベースからアクセスした場合、行を取得することができますが、私が繰り返した後にこれらの行をクエリするclose()とopen()、カーソルは行を返しません。