我做了预订申请,我想检查一下是否可以离开。我已设法将数据从mysql显示到微调器。问题是如何保存微调器的选择,然后检查mysql?抱歉愚蠢的问题。我非常感谢你的回答,谢谢:)。
这里是代码
Spinner spinner = (Spinner) findViewById(R.id.Spinner01);
ArrayAdapter<String> adapter =
new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, content);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Spinner spinner2 = (Spinner) findViewById(R.id.Spinner02);
adapter .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
spinner2.setAdapter(adapter);
答案 0 :(得分:1)
使用 AdapterView.OnItemSelectedListener 实现您的类并覆盖onItemSelected函数
Spinner spin1=(Spinner)findViewById(R.id.spnfirstyear);
spin1.setOnItemSelectedListener(this);
//Overide
public void onItemSelected(AdapterView<?> parent, View arg1, int arg2,
long arg3)
{
// TODO Auto-generated method stub
item = parent.getSelectedItem().toString();
//do some mysql in item
doDatabase(item);
}