make a variable final in Android Studio

Posted by user3664685 on Stack Overflow See other posts from Stack Overflow or by user3664685
Published on 2014-06-10T15:15:33Z Indexed on 2014/06/10 15:24 UTC
Read the original article Hit count: 297

Filed under:
|

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.

  }
});
}

© Stack Overflow or respective owner

Related posts about java

Related posts about android