1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
public void onCreate(Bundle savedInstanceState) {
Cursor c1 = db.rawQuery("select * from questionnaire",null);
ScrollView sv = new ScrollView(this);
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);
sv.addView(ll);
c1.moveToFirst();
//declaration
String r1= null,r2= null,r3= null,r4= null,rf= null,que= null;
String rep1 = null,rep2= null,rep3= null,rep4= null,repf= null,question= null;
while (!c1.isAfterLast())
{
//rep1
r1=c1.getString(0);
r2=c1.getString(1);
r3=c1.getString(2);
r4=c1.getString(3);
c1.moveToNext();
TextView tv = new TextView(this);
tv.setText(r2);
ll.addView(tv);
RadioButton cb1 = new RadioButton(this);
cb1.setText(r3);
ll.addView(cb1);
RadioButton cb2 = new RadioButton(this);
cb2.setText(r4);
ll.addView(cb2);
}}
this.setContentView(sv);
}
} |
Partager