Those who invented Android and Java didn’t invented for themselves. Since I started developing application with Java in Android I get the most ridiculous errors and I am really going crazy (and if I do, Google and Sun Microsystems will make “booooom”)
I have this simple code that is supposed to get the length of a string passed as an argument. The application just crashes, making me spend some minutes swearing and torturing the keyboard.
My code:
@Override
protected void onPostExecute(String result) {
if (result.length() == 0) {
txtStatus.setText("Ready");
}
}
If I remove the condition it works (the text “Ready” is shown on my TextView). This is something weird and I know that I might be missing some little something.
Give me some clues and thanks for everything!
P.S. If you hear a gun shoot coming from your neighbor it might be me.
Its because your string is perhaps null. Do it like this: