我有一个微调,编辑文字,按钮,在视图列表视图。 我想我的加载从的ListView数据库从微调框中的值取决于。 我正在做的事情列表视图还添加操作。
我怀疑的是,我想知道我如何可以加载我的列表视图依赖于从旋转的数据?
public class myClass extends ListActivity implements OnClickListener {
DatabaseFAM db;
Spinner No;
String Selected;
EditText user;
Button btnAdd;
String strselected;
ArrayList<String> list =new ArrayList<String>();
ArrayAdapter<String> adapterLV;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.myews);
db = new DatabaseFAM(getApplicationContext());
initVar();
}
private void initAudit2Var() {
No = (Spinner) findViewById(R.id.station);
user = (EditText) findViewById(R.id.er);
btnAdd = (Button) findViewById(R.id.btnAdd);
btnAdd.setOnClickListener(this);
adapterLV = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_multiple_choice, list);
setListAdapter(adapterLV);
final DatabaseFAM db = new DatabaseFAM(getApplicationContext());
List<String> station = db.getAllstation();
ArrayAdapter<String> stationAdapter = new ArrayAdapter<String>(
getApplicationContext(), android.R.layout.simple_spinner_item,
station);
stationAdapter
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
No.setAdapter(stationAdapter);
No.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
Selected = arg0.getItemAtPosition(
arg2).toString();
list.clear();
list=db.getTag(Selected);
adapterLV.notifyDataSetChanged();
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
});
}