I've run into a weird issue with Java for Android. I'm creating a listener for a button and I need to grab a text edit as a string and return it into a string to be used as an authentication check.
I'm getting an error that I need to declare the variable AccessCraw
as final and when I create it as a final it says that I can't edit it. How can I preform this without getting a whole bunch of errors? (code below)
boolean loggedin = (false);
boolean acsessgranted = (false);
final String AccessCraw = "no";
Button submit = (Button) findViewById(R.id.Submit);
Button startBtn = (Button) findViewById(R.id.EmailAdmin);
final EditText AccessCode = (EditText) findViewById(R.id.ACentry);
if(acsessgranted == (false)) {
setContentView(R.layout.activity_frun);
}
if(acsessgranted == (true)) {
if(loggedin == (false)) {
setContentView(R.layout.login);
}
}
if(acsessgranted == (true)) {
if(loggedin == (true)) {
cont ();
}
}
startBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
sendEmail();
}
});
submit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
AccessCraw = AccessCode.getText().toString();
}
});
}