I am having an edittext and an icon. Clicking on this icon I show DateTime Picker. I have set setFocusable(false); and using setError on this edittext. But when any error occurs only icon is getting shown. Text is not getting shown at all. I have tried _input.setFocusableInTouchMode(true); also but it gives users to enter any text in this edittext which I do not want as I have created this edittext for date time only.
So, how can I show the error message then, can someone please help me.
Thanks a lot in advanced.
Add following lines to your code:
et.setFocusable(true);
et.setFocusableInTouchMode(true);
et.requestFocus();
Why do you use an edittext, if you do not want the user to input text? you can use a textView and textView.setText("your time") instead.
You use like this if you want to set Error on your edittext with icon
ed_emailId.setError("your Error message",R.drawable.ic_profile);
and if you want to set only error and icon will default then use like
ed_emailId.setError("your Error message");
i hope this will help you
Related
I'm trying to create a search bar like.
I have to use a particular autofill, infact I can't use a dropdowns menu.
For example if I write Noce the edittext will have to suggest Nocera in the same editText, like this.
but if the user write something else the pointer have to the end of the typed text (in this case Noce) and the hint have to disappear.
Is there some library that allows me this?
Thanks for the help.
There's this library that will fulfill some of your requirement called Auto Fill EditText
Finally I have solved this using two EditText in the same position. The first one is a normal editable EditText, the second one is not editable from the user but is used to show the hints programmatically.
I am working with 4.0+ EditText and have to perform validations on a bunch of fields. When a validation fails, I have to change the color of the EditText to red and display a message. Now, I have easily customized the EditText using style and theme, but there is no state for error which I can use in the state list drawable. Any ideas on how this can be achieved?
Why not use EditText.setError(CharSequence error)
The result will look like this
I got it working using LevelListDrawables
I am developing an Android application and I need to put a link beside a Text Edit in a form.
The link will pop up a window that holds a tool tip for the user.
EDIT : I want to put some sort of a link beside the text field and, when the user clicks on this link, a pop up window appears and tells him how to fill this text field.
How can I do this in Android ?
Can anyone help me please ?
The "link" can easyly be created by puting a TextView and adding an OnClickListener.
About the "popup":
Have you had a look at Toast-messages? They seem to be doing exactly what you want to do.
Toast toast = Toast.makeText(Context context, String yourMessage, Toast.LENGTH_LONG/SHORT);
toast.show();
If you had, here are some other solutions that could do what you want:
What about a solution with some kind of Dialog? Eg. an AltertDialog could open up, showing the tip, but the User would have to press "OK" to close the "popup".
Another solution, which is also quite ugly would be playing with visibilities. the "popup" would be present allt he time, but only visible if the link is clicked.
How to change visibility of layout programaticly
use android:hint="Your hint" for your EditText to show hint.
I want get text like phone number inside a textView by parcing, and i want use this getSelectionStart(), but it dosen't work?? can someone give me an example please.
I made a bad first answer because I mixed getselection with the new text api of 2.3.
You will find some answer in those thread :
Android - get selection of text from EditText
How to use getSelectionStart and getSelectionEnd of EditText when user touches EditText?
Hi friends
I have an editable text box with a default value like to display to the user like "entername". If the user touches the edit box, I want to clear the value of edittext box and show the virtual keypad to the user, and if the user presses the enter key, only in the edit text box, I have to start another activity. How do I do this?
Hi in android:hint at the type of key pressing only it clear value I want to on touch in edit text box clear value and show virtual keypad to user. How do I do this?
Thanks
What?
I really don't understand what you're asking, but it seems like you might be trying to do a hint? Rather than setting an onTouchEvent listener, add a android:hint="What to do" attribute to your EditText.
U use the following code
EditText EditTextName=findViewById(R.id.EditText01);
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(EditTextName), 0);
use this code in ontouchListener of EditText
Mohan if I am correct you have two questions here
How to display a hint in an edit box
How get some data from a web service
For the first question you can use android:hint="Enter Name"
For the second one you need to give us more info on what you are trying to do