I want to show all my validation error's of EdiText
fields in a popup as shown in below image:
As far as I know Android has drawables:
1) popup_inline_error.9.png
2) popup_inline_error_above.9.png
3) indicator_input_error.png
I am able to display the red error indicator inside the right side of the EditText
by using:
Drawable err_indiactor = getResources().getDrawable(R.drawable.indicator_input_error);
mEdiText.setCompoundDrawablesWithIntrinsicBounds(null, null, err_indiactor, null);
Now also i want to display the error message as shown is the first image but it seems I am not getting any idea about this, though I think it should be a Custom Toast.
As the earlier answer is solution for my problem but I have tried a different approach to use a custom Drawable image instead of default
indicator_input_error
image.Default Drawable
Custom Drawable
So, I have just created two
EditText
in my layout xml file and then implemented someListener
in Java code on thatEditText
.main.xml
EditTextValidator.java
Now I have tested it like:
Suppose user click on the
Username
field then Softkeybord opens and if user pressNext
key then the user will be focused to thePassword
field andUsername
field remains empty then the error will be shown like as given in below images:1) I type the text
vikaS
in Username field then error will be like as given in below image :2) I type the text
Password1
in password field then error will be like as given in below image :Note:
Here I have used custom drawable only in case of when user left the EditText field blank and press Next key on key board but you can use it in any case. Only you need to supply
Drawable
object insetError()
method.I know answer has been accepted by the asker, but none of the above worked for me.
I was able to reproduce this on my Nexus S running Android 4.0.3.
Here's how I made it work.
Create a theme with:
Apply
MyApp.Theme.Light.NoTitleBar
theme to my application / activity from manifest.try this..