Type in EditText with buttons - android

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.

Related

How to make a text field that can be entered when the user clicks it but otherwise is disabled?

I think I'm missing something very obvious here.
All I want is a field where users can enter a parameter that affects the app, for example -100
I want the field to be visible on the screen, displaying the current value of the parameter, but not with a cursor in it or underlined in red or anything. Simply visible, but if the user wants to change the parameter, they can click in the box and change the value.
Many thanks for your help!
You can try to add both TextView and EditText in your layout, then show and hide based on your need.
Just show EditText by default and add TextWatcher on it, when enter is pressed or saved, then show your TextView with value from EditText. Then write onClickListener for TextView to show EditText again.
Hope that makes sense.

Can i let the user delete/close an edit text if he doesn't want to type anything?

i have a lot of EditTexts. I want the user to delete some edittexts if he doesn't want to type anything and i want that edittext to go away from the screen. Can i do that?
Yes you can do that by changing the visibility. First set visibility of the edittext as setVisibility(View.INVISIBLE) then setVisibility(View.GONE).

AutoFill EditText Android

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.

Android how to get Suggested strings array of the TextEdit

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

Edit text view issue

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

Categories

Resources