我有两个微调器是区域,另一个是城市我想改变城市微调器的价值随着区域的变化。这是我的代码 taluka.setOnFocusChangeListener(new OnFocusChangeListener(){
@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
System.out.println("on focus"+hasFocus);
if(hasFocus==false)
{
String district= District.getSelectedItem().toString();
if(district.equalsIgnoreCase("Ahmednagar"))
{
ArrayAdapter<String> spinnerCountShoesArrayAdapter = new ArrayAdapter<String>(Sign_up.this, android.R.layout.simple_spinner_dropdown_item, getResources().getStringArray(R.array.Ahmednagar_taluka));
taluka.setAdapter(spinnerCountShoesArrayAdapter);
}
else if(district.equalsIgnoreCase("Akola"))
{
ArrayAdapter<String> spinnerCountShoesArrayAdapter = new ArrayAdapter<String>(Sign_up.this, android.R.layout.simple_spinner_dropdown_item, getResources().getStringArray(R.array.Akola_taluka));
taluka.setAdapter(spinnerCountShoesArrayAdapter);
}
}
}
});
我试图在第一个失去焦点时这样做。