Displaying error messages in forms on Android is really simple. Most widgets have a
setError(CharSequence text) method that can be used to indicate problems.
Say you have a form where you have to enter a product. Now while entering more data into the form the app might check the product number and some backend service might say, that the number is invalid. In this case a quick feedback would be nice. That's exactly what can be done with this method:
setError() method is only available for widgets that extend
TextView. But gladly all relevant Widgets for error messages do inherit from
RadioButton (well, the hierarchy is weird, but never mind).
But there is one problem with using this approach. The message text is only visible when the view has the focus. Otherwise Android only displays the red marker. Try setting the focus on a touch screen with a radio button or a check box. Good luck to you. If you have a keyboard, trackball or so on, this is okay. But for most devices the necessity to focus is bound to fail. I would have preferred if the exclamation mark would have been clickable. Of course you can add a click listener and focus yourself, but this kind of defeats the purpose of this approach.
On the other hand this might not be that bad, since check boxes should only rarely fail a check and radio buttons in my opinion should never be allowed to do so. For check boxes a shopping app comes to mind where you must tick a check box to agree to some conditions before being able to proceed.
Then there is also the oddity that for
EditText fields the error hint disappears as soon as the field has lost its focus. In my opinion the hint should only disappear when the value has changed.
Even despite the mentioned problems you should add a
setError() method whenever you create you own widgets. And you should not stray too far from the standard design and usage patterns for displaying problems in your apps. As always I would recommend to stay close to the platform but adopt to your needs.