I'm having a strange problem with the android edittext inputfield.
I use the edittext field to let the user of an app answer questions that are generated by the app.
Now this works fine...but every now and again.. completely random (i.e. i could not find the pattern) the edittext field stops displaying the input after the first part of the first input character. To test I type in an incorrect answer to the question many times in a row. The problem occurs anywhere between the first and the 500th or so repetition of the wrong answer. It's only a display issue because all the inputted characters can be retrieved from the edittext field (with gettext() ).
I did not find this behaviour on my simulations only on my test phone (samsung galaxy s)
I could not find anything in the log...
The editfield is on a TabHost-tab. When i switch to another tab and return everything is fine again, the same applies to rotating the device to landscape and back.
Did anybody ever encounter this strange behaviour : edittext stops showing text after only part (looks like 1 or 2 leftmost pixels of the character) of the first inputted character..and can point me to a direction ?
I think this is to do with the phone. I was testing one of my apps on a few phones, one of which was a Samsung Europa, and everyone once in a while, the text in the EditText went funny, and on very rare occasions, the EditText boxes didn't render properly. Like you said, changing to landscape and back fixes the problem but I think it's not a problem you can fix, just a problem with Samsung's product.
Related
I am using the following element in the Android EditText, to have a keyboard with number and decimal for displaying a keyboard layout for amount input (for eg 22.12).
android:inputType="numberDecimal"
It is working for all devices, like Samsung, Nexus, Sony etc.
The keyboard layout looks like below.
The keyboard layout on the LG G4 looks like below.
Could anyone please help, how to have decimal keyboard for the LG G4. I have already tried the android:inputType="phone", still same issue.
I would like to stick to the decimal input, as it would not be very nice to have a full alpha-numeric keyboard, to enter amount.
Thanks in advance.
UPDATE
It seems that flag signed is not needed after all to get decimal separator, It was actually the TYPE_TEXT_FLAG_NO_SUGGESTIONS that messed up the keyboard so do not use it with number input types. Also noticed that LG keyboard looks different depending on if you set the input type from code vs. XML
END UPDATE
It seems like the combination of inputType and digits solves the problem. I have a class that extends EditText so I initialize the EditText like this:
setKeyListener(DigitsKeyListener.getInstance("0123456789.,"));
setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED);
I guess that because LG has bundled decimal separator and minus sign in a same button you have to configure both feature on and then disable "-" by not including it in digits.
There are 2 possible ways i can think of, but i do not have an LG make phone, so i personally couldn't test any of these. But still its worth a shot.
Try to give the input type as android:inputType="phone".
Saw this on the dev site, more details here https://developer.android.com/training/keyboard-input/style.html#Type
This one i tried a couple of years back, it worked for me, but my case was different. Specify an attribute in your EditText item in xml.
android:digits="0123456789."
What it does is, sets the view to accept numeric input and only the specific items mentioned in the digits attribute. I personally do not use it much, its more of a hack than a solution, but it gets things done. More info on the below link:
https://developer.android.com/reference/android/widget/TextView.html
Try these out, hope they help for all cases.
We observed a very strange bug with our app on the samsung s3 (running android 4.0.4 )
When typing text into a text area only the first character of each word would fill in, and only after you pressed space or picked a word from predictive text.
Typing 'what the hell ..' would result in 'w t h' being entered in the text area
Other text areas on different screens were working fine.
Turning off predictive text also fixed the issue.
Has anyone run into this issue before?
After further investigation we noticed that the problematic textarea wasn't changing appearance when it got focus - all our working text fields turned into square cornered fields with orange borders when clicked.
It turns out android does something odd and dynamically replaces your input fields with native elements as they get focus (hence the un-style-able orange bordered square bits :( ).
the kicker - if your input is inside an element with css absolute positioning this fails, and this also seems to mess up some forms of keyboard input. setting the element (and parent elements) to use position static fixes the issue.
We only saw this on the s3 when predictive text was on (this is the default..) but it may be on other devices.
Chalk this one up to Androids browser still being a mess..
Note that using this css hack to stop the native elements from being substituted:
input:focus { -webkit-user-modify: read-write-plaintext-only; }
caused ALL our text fields to have the problem outlined in this thread.
I had this problem too for a long time but have found that the key to stopping this glitch is to turn off the predictive text option in the keyboard settings every time you experience the 1st character input only problem. Personally, I like the predictive text being on 99% of the time, but some web pages (email providers mainly) aren't configured for predictive text to be used, so I keep predictive text on & just turn it off whenever I come across a web page where I experience the 1st character input only problem. To turn it on/off simply hit the cog button on the keyboard & where it says predictive text, just swipe the slider to the left, to the off position. This will allow whole words to be typed instead of just 1 character at a time. Then, once you've finished typing, you can hit the cog again & turn predictive text back on.
I have a MultiAutoCompleteTextView implemented on one of my screens. I was testing the application in various smartphones and when I tested in a smartphone that had XT9 turned on the texbox works, however when the word was selected in my textbox the XT9 does not clean the letters already typed, then when I started to type again the previous letters from the first word show up.
So I need to turn of XT9 in this screen or clean XT9 letters list. Someone knows how to do it?
Thanks
I found that to disable the autocomplete of the Input I just needed to add the attribute android:inputType="textAutoComplete" on the MultiAutocompleteTextView's xml
I have an EditText widget in my Android application with inputtype=number. It does restrict character to entry by number. However, when I type certain alphabetic keys on the emulator's keypad (not all of them) I see numbers appear in the edit box. For example, typing an "F" puts a "6" in the edit box, "D" puts a "5", etc. Why is this happening?
-- roschler
I've seen two things happen, depending if you're on the emulator or on the phone, and depending on the SDK version:
The full keyboard appears (older SDKs). The behavior is exactly what you said: you can only type numbers, but certain characters can also be typed, and are translated to numbers. That behavior is explained by what Aleadam said.
The soft phone keypad (mostly on modern SDKs and phones, as far as I've seen). The typical phone keypad appears... "2ABC", "3CDE" and so on...
On both situations, you will see that, in fact, only numbers can be entered, which is what we want. As an example, in preference screen, you can perfectly cast the Object newValue into a Integer and you won't have any problems.
I do that all the time, don't worry!
It emulates the portrait keyboards that can be used to dial numbers also. Nothing wrong with your particular widget :)
If you enable that tag the emulator keyboard works like a T9.
ABC will be 2
DEF will be 3
etc.
It's normal, it's not a bug!
My application has a simple 'About' box.
It has a few clickable TextViews (email addresses, phone nos, addresses) all contained within a relative layout within a ScrollView (To accommodate low res screens).
The device I am testing with (Motorola Charm O.S ver 2.1 update 1) has a regular QWERTY keyboard. The problem I am facing is with the use of the arrow keys.
I want the cursor to move predictably from one clickable field to the next and this is where I need help. On the fields that don't need focus I have set the android:cursorVisible="false".I tried using the android:nextFocus* properties but still don't get the desired behavior.
The cursor gets stuck in the first field and overall the behavior is a bit unpredictable. Any ideas on how to get this done. Right now trapping the keys using code seems to be the only option.
TextView.setMovementMethod(LinkMovementMethod.getInstance())
The documentation is a little terse but it's basically what you are looking for.