sqliteのすべてのデータをリストビューに表示するにはどうすればいいですか?すべてのデータフォームのsqliteデータベースをリストビューに取り込む方法は?
「すべて表示」ボタンをクリックするたびに、複数のデータを追加しても1つのデータしか表示されません。私はどのように私のすべてのデータを表示できますか?
ありがとうございました!
ここに私のコードは次のとおりです。
MainActivity.java
if(view==btnViewAll){
setContentView(R.layout.activity_view_all);
TextView id = (TextView)findViewById(R.id.idno);
TextView name = (TextView)findViewById(R.id.name);
TextView grade = (TextView)findViewById(R.id.grade);
TextView school = (TextView)findViewById(R.id.school);
TextView program = (TextView)findViewById(R.id.program);
TextView course = (TextView)findViewById(R.id.course);
TextView email = (TextView)findViewById(R.id.email);
TextView bday = (TextView)findViewById(R.id.bday);
TextView address = (TextView)findViewById(R.id.address);
TextView gender = (TextView)findViewById(R.id.gender);
Cursor c = db.rawQuery("SELECT * FROM student", null);
if (c.moveToFirst()){
id.setText(c.getString(0));
name.setText(c.getString(1));
grade.setText(c.getString(2));
school.setText(c.getString(3));
program.setText(c.getString(4));
course.setText(c.getString(5));
email.setText(c.getString(6));
bday.setText(c.getString(7));
address.setText(c.getString(8));
gender.setText(c.getString(9));
}
}
}
Here is the layout where i want to display all my data