-1

我在数据库中有标记和类现在我想创建文本视图动态设置从数据库到文本视图的结果我能做到吗

private void displaymarks() {
    // TODO Auto-generated method stub
    Cursor c=marksdb.rawQuery("SELECT class,marks FROM  markstb where class='"+clas+"' ",null );
    c.moveToFirst();
     if(c!=null)
     {
      do{
        int c1= c.getColumnIndex("class");
        int c2=c.getColumnIndex("marks");
        s1 = c.getString(c1);
        s2 = c.getString(c2);

      }while(c.moveToNext());

      };
    }
4

1 回答 1

0
TextView tvClass=(TextView)findViewById(R.id.class);
TextView tvMarks=(TextView)findViewById(R.id.marks);
while(c.moveToNext())
{
  tvClass.setText(s1);
  tvMarks.setText(s2);
}
于 2012-12-31T18:25:38.107 回答