make a variable final in Android Studio
- by user3664685
When I try to make the variable A(String) equal to e(Which comes from a Plain Text)
this appears in the line of the error(In the code below):
Variable 'e' is accessed from within inner class, needs to be declared final.
I don't know how to make 'e' final.
public void MORSE(View v)
{
EditText e=(EditText)findViewById(R.id.text);
TextView T=(TextView)findViewById(R.id.translation);
Button TRAD=(Button) findViewById(R.id.translate);
TRAD.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view){
String A;
A=""+e; //HERE IS THE ERROR.
}
});
}