Can anybody tell me how to use setError function appropirately for CheckBoxes and RadioButtons. I am able to raise the error icon symbol (!) after my textView but cannot see the error message . As per Android’s documentation :
sets the right-hand compound drawable of the TextView to the "error" icon and sets an error message that will be displayed in a popup when the TextView has focus. The icon and error message will be reset to null when any key events cause changes to the TextView's text. If the error is null, the error message and icon will be cleared.
Can you someone provide an example of the proper implementation of setError in case of checkbox aand radioButton?
Here is my code –
CheckBox box=(CheckBox)findViewById(R.id.propertyStatus1);
box.setError("Error");
To display the seterror for checkbox and radiobutton its working. Your code also right for displaying set error.
At first only the error icon will be displayed. When focus went the error message will be displayed.
To receive focus on these types of elements add
android:focusableInTouchMode="true"