如何将链接到此外键的所有行提取到文本视图中

时间:2011-12-14 12:08:01

标签: android cursor textview

我有一个游标,用于获取外部ID等于int ID的行。现在我想迭代这个游标并将所有行提取到文本视图中。这是我到目前为止所得到的,但它并没有取得任何东西。     data.open();             / * Cursor cursor = data.fetchRow(ID);

        if (cursor.moveToFirst()) { // data?

            Speech.setText("Recipe Name: " + cursor.getString(1) + ". \n" + "Recipe Category: " + cursor.getString(2) 
                    + ". \n" + "Recipe Description: " + cursor.getString(3) + "/n");
        }*/

        Cursor cursor2 = data.IngredientfetchRows(ID);
        startManagingCursor(cursor2);
        cursor2.moveToFirst();

         if (cursor2.moveToFirst()) { 
             do 
         {

                 Text= cursor2.getString(1);
                 Speech.setText(Text);
                 Toast.makeText(this,Text, Toast.LENGTH_LONG).show();

         } 
             while (cursor2.moveToNext());

         }




        data.close();   

0 个答案:

没有答案