当我编写这段代码时,我看到了这个错误。
我在标记行中看到“无法分配最终的局部变量 peyvaDawi,因为它是在封闭类型中定义的”。
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ferheng=new Veritabani(this);
final ImageButton btn=(ImageButton)findViewById(R.id.btnBigere);
final EditText edtPeyv=(EditText)findViewById(R.id.edtPeyv);
final RadioButton rbKT=(RadioButton)findViewById(R.id.rbKT);
final RadioButton rbTK=(RadioButton)findViewById(R.id.rbTK);
final String peyvaDawi="emre";
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
final boolean KT=rbKT.isChecked();
final boolean TK=rbTK.isChecked();
sonuc="";
String strPeyv=edtPeyv.getText().toString();
Boolean tenePeyv=false;
if(strPeyv==peyvaDawi)
tenePeyv=true;
else
tenePeyv=false;
if(KT)
Arama(strPeyv,"kurdi",tenePeyv);
if(TK)
Arama(strPeyv,"tirki",tenePeyv);
peyvaDawi=strPeyv;//<<<<<<<<<<<<<<<<< i see error in this line.
}
});
}
我在 peyvaDawi=strPeyv 行中看到错误;