I’ve this part of code:
public void onClickHandler(View a) {
String pressed = null;
String actual_text = null;
String new_text = null;
char last_char; //or char last_char = (Character) null; - the same problem
int bla;
pressed=((Button)a).getText().toString();
EditText lifeView = (EditText) findViewById(R.id.edittext);
actual_text = lifeView.getText().toString();
bla=actual_text.length()-1;
last_char = actual_text.charAt(bla);
}
And I’m solving the problem, that after pressed button I will get the error “The application has stopped unexpectedly. Please try it again.”
The problem is on the line “char last_char” — but I don’t know why, Eclipse does not report a fault too…
You need to initialize the
char last_char;Ex:
or similar but not null.