当我选择Spinner
文本时,Dialog box
会出现其中有EditText
.I want to Display
that EditText
string to 的Spinner
。
代码
private void Showdialog() {
myDialog = new Dialog(this.context);
myDialog.setContentView(R.layout.mydialog);
myDialog.setTitle("hh");
myDialog.setCancelable(true);
editText=(EditText)findViewById(R.id.editText1);
Button button = (Button) myDialog.findViewById(R.id.but);
// EditText editText=(EditText)findViewById(R.id.EditText01);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
clickAction();
}
});
myDialog.show();
}
void clickAction() {
myDialog.cancel();
mySpinner.setTag(editText.getText().toString());
}
和微调代码
mySpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
String cardStatusString = parent.getItemAtPosition(pos).toString();
if(cardStatusString.equals("Other")) {
Showdialog();
}
}
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
} });