07.04.2011 15:57, Gabriel пишет:
I'm making kind of a calculator and everything is working fine.
Except when I leave one of the 4 EditText fields blank, the
application cracks ("stops unexpectly").
How can I work this out?
In general, when something like this happens, you use the debugger to
find out what's really happening.
Some ideas:
When an EditText is empty, its getText returns null.
When you call toString() on a null object, you get a NullPointerException.
It would be good to, when this happens (EditText blank) just put a
"empty" message at the destination.
Take a look at this:
http://developer.android.com/reference/android/widget/TextView.html#setError(java.lang.CharSequence)
--
Kostya Vasilyev -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en