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
Related
My requirement is that when user clicks on edittext, a dialog should pop up enabling the user to select one of the values from lit.
The above portion has been accomplished.
I do not want user to enter/edit any other value than values given in list in dialog. I want user to select only the values given in list in dialog.
I am facing the problem in accomplishing this part.
Please help.Many thanks in advance.
Regards,
Pawan
See This answer.
From the link:
Add android:focusable="false" to your EditText. And set OnClickListener to that EditText. The click on that Edittext triggers the onClick() method but it can't be edited.
How about setting inputtype of EditText to null?
Programatically:
editText.setInputType(InputType.TYPE_NULL);
XML:
android:inputType="none"
The edtText.setText(String) method will still work normally.
Setting android:focusable="false" worked for me. It will not enable user to edit data and force him to select from list in dialog.
Thanks #JonasCz for answer
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.
Is there a way to get an array of the suggestions strings which are shown when you typing in EditText? The problem is I have an EditText and in case of user use "Show Suggestions" option the result of the string from this EditText is different in case of user pressed, lets say UI button (this is a Button from the layout), and a return button at the soft keyboard. In first case user gets an exact string but in second - it gets corrected (suggested) string even user do NOT select this suggestion. How to solve this problem? How to get from EditText "suggested" string? Do I need to implement my own IME?
Maybe this can help you ? Hello Auto Complete
Or if you want to write one on your own.. Writing your own autocompleteview
Are you trying to disable suggestions or to modify them?
If you want to disable them completely, check this out:
How to disable displaying "suggestions" on the Soft Keyboard
I have a few forms that the user has to fill in and I use EditText to enter the information.
the problem is, when the user uses the virtual keyboard there no information about which field he is filling in.
so its fine when there is only one field but when he has 4 or more he fills in the first one, presses next and he has to remember what was the second field and so on
is there a way to set a title in the EditText so that instead of being just a text zone it has a title to remind the user what he is inputing ?
You can add a hint, which pre-fills the EditText with a useful reminder (in a faded-out colour). This disappears when the user starts typing.
android:hint="Type your name here"
Unfortunately the input method editor bits don't let you do that (though that would be nice). Try setting the attribute android:imeOptions="flagNoExtractUi" on the EditText instances.
So I hid the soft keyboard because I only want "1" and "0" to be the buttons to type with and a delete button. I have two EditText boxes. How do I go about letting the user click on the EditBox and be able to have those Buttons only type in that box? and same with the delete. I only need to know how to make it recognize that you have chosen that box. Take whats there and add "0" to the end of the string.
Thanks
If all you are looking for is to get the EditText that is selected, then use the hasFocus() method on each EditText. The method returns a Boolean value depending on whether or not it has focus (has been selected by the user). Then insert your text into the EditText that has focus.
If this does not help, I've done something similar to this before and can offer you a different solution.