public void huadonganniu(View v){
/*Intent intent1=new Intent();
intent1.setClassName("com.example.t", "com.example.t.TService");*/
btn_huadongkaiguan=(ToggleButton) findViewById(R.id.btn_huadongkaiguan);
et_guanbi=(EditText) findViewById(R.id.et_guanbi);
et_ok=(EditText) findViewById(R.id.et_ok);
et_caidan=(EditText) findViewById(R.id.et_caidan);
et_shezhi=(EditText) findViewById(R.id.et_shezhi);
et_fangxiang=(EditText) findViewById(R.id.et_fangxiang);
et_fanhui=(EditText) findViewById(R.id.et_fanhui);
et_a=(EditText) findViewById(R.id.et_a);
et_b=(EditText) findViewById(R.id.et_b);
et_c=(EditText) findViewById(R.id.et_c);
et_x=(EditText) findViewById(R.id.et_x);
String msg3=btn_huadongkaiguan.getText().toString();
EditText[] arr=new EditText[10];
arr=new EditText[]{et_guanbi,et_ok,et_caidan,et_shezhi,
et_fangxiang,et_fanhui,et_a,et_b,et_c,et_x};
if (msg3.equals("guan")) {
for (int i = 0; i < arr.length; i++) {
arr[i].setText("");
arr[i].addTextChangedListener(new NewTextWatcher(arr[i],i));
}
}
}
public enum anjian{guanbi,ok,caidan,shezhi,fangxiang,fanhui,a,b,c,x};
anjian onet,twot,thr,fro,fiv,six,sev,eig,nin,ten;
class NewTextWatcher implements TextWatcher{
private EditText editText;
private int z;
public NewTextWatcher(EditText editText, int x) {
this.editText = editText;
this.z=x;
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// TODO Auto-generated method stub
}
就是在那个if(z==0)
那块需要把data1的值赋给enum anjian里的guanbi这个元素
直接在if(z==0)那块写anjian.guanbi=data1 报错了
但是 data1好像也无法赋值给enum anjian 下的onet变量 第一次接触到 枚举这个概念 请教下 各位大牛了 又得麻烦你们了
胡说叔叔
相关分类