To display seterror for checkbox and radio processing, it works. Your code is also suitable for displaying a fixed error.
CheckBox cb=(CheckBox)findViewById(R.id.checkBox1); cb.setError("error");
At first, only the error icon will be displayed. An error message will appear in focus.
To get focus on these types of elements, add android:focusableInTouchMode="true"
user1213202
source share