我创建了一个打开对话框的布局,进入对话框后,用户选择ok/cancel.我想刷新listView以重新查询数据
这是我打开对话框的布局:
button.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
Intent myIntent = new Intent(SchoolActivity.this, InsertSchool.class);
update();
startActivity(myIntent);
updateList();
}
});
update();
cursor.requery();
String[] from = new String[]{Database.KEY_ID2, Database.KSCHOOL, Database.KSCHOOLCODE};
int[] to = new int[]{R.id.rid, R.id.rt1, R.id.rt2};
cursorAdapter =
new SimpleCursorAdapter(this, R.layout.row_school, cursor, from, to);
listContent.setAdapter(cursorAdapter);
Run Code Online (Sandbox Code Playgroud)
单击该按钮后,我想刷新listView.这是对话框(我认为刷新将在ok和cancel按钮上完成).
ib.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent=new Intent(InsertSchool.this, SchoolActivity.class);
startActivity(intent);
}
});
update();
mySQLiteAdapter = new Database(this);
mySQLiteAdapter.openToWrite();
cursor = mySQLiteAdapter.queueSchoolAll();
ib1.setOnClickListener(new OnClickListener() {
public …Run Code Online (Sandbox Code Playgroud)