Android text cursor in EditText - android

I'm writing an application for android 2.1+. In one of my activities i have EditText with custom keyboard (KeyboardView with key mappings in keyboard.xml). Everything works perfect on android 2.1 ( everything is shown correctly - text cursor is flashing), problems start on android 2.3.3 where textcursor in edittext is visible but not blinking, and on android 3.0+ text cursor is just invisible - in both cases keyboard is working correctly. I'm struggling with this problem from couple days... any thoughts would be really helpful.
There is one thing which i should mention earlier. This activity is split into two fragments (android support library), EditText is on one of them, and the keyboard is called from parent activity.

When i faced this problem before, the solution was to disable hardware acceleration on the activity that contains the edit text, by modifying the manifest like this:
<activity android:name="activity name" android:hardwareAccelerated="false"/>

Related

Android 10 EditText box not updating with keyboard inputs

I've been thrown into trying to fix bugs in an app I didn't write, and I'm not all that familiar with Android. I'm having problems with text boxes not updating with keyboard inputs. Here's whats happening:
In android 10 (only) when I click on a text box, type stuff with the soft keyboard, nothing shows up in the textbox until the soft key board is minimized. But it works 100% fine in Android 5.1, 6, 8.1. (Also, compiling app with SDK for Android 8.1 or 10 makes no difference). The text box is never covered or hidden by the keyboard, it just remains empty until the keyboard is minimized.
The only thing that works is if I make the keyboard floating type, or if I position the textbox way at the top of the layout such that Android does not need to pan or resize the view to accommodate both the box and the default keyboard. A floating keyboard works anywhere, even partially over top of this text box.
I have tried every possible parameter combination I can find in the manifest and layout xml files, including android:windowSoftInputMode , android:fitsSystemWindows , android:isScrollContainer , android:gravity , android:paddingBottomandroid:configChanges
The fact this is -only- an issue for Android 10 is suspicious.
For anyone that finds this in the future: the issue turned out to be that hardware acceleration needed to be turned on. See EditText in Android doesn't show text when typing while using the on-screen keyboard

Reason for the slow soft keyboard input in android

I had implemented one application in which lots of forms are there.
The forms contain EditText box.
When I am trying to type in that text box using soft keyboard the response is too slow.
If I am making a new activity and using a layout only with the edittext box then its responds as soon as I tap on any character.
So what can be the reasons for slow response in edittext box typing?
Thanks,
bskania.
Try making activity on ActivityManifest;
android:windowSoftInputMode="adjustPan"
The keyboard response is slow to various reasons.
I too faced this situation, In my case, there was a lot of images and tabs in the neighboring tabLayout , which was causing the issue.
I just hide (Visibility.GONE) the layout where there are a lot of bitmaps and all when I switched into the tab where there is editText. And added this line into manifest
android:windowSoftInputMode="stateHidden|adjustResize"
it resolved my issue.

Android Edit Text Cursor Doesn't Appear

in my app I disabled the keyboard (I use now my custom keyboard) using this code:
editText.setInputType(InputType.TYPE_NULL);
Now, my problem is that the text cursor does not appear anymore in the edit text. What should I do? Any suggestion would be very appreciated.
There is an Issue opened in bug tracker Issue opened in bug tracker for this.
One of the users suggests the approach which works on "most" devices.
Briefly, all you have to do is call:
editText.setRawInputType(InputType.TYPE_CLASS_TEXT);
for your EditText view (after you called editText.setInputType(InputType.TYPE_NULL);).
You should probably also set:
editText.setTextIsSelectable(true);
in order for text to be selectable (though in does not seem to work properly with Samsung Galaxy SIII). This method is only available starting from HONEYCOMB (api11) so keep that in mind when developing for older Android versions.
Also it is stated that your EditText should not be the first view to receive focus when activity starts (if it is - just requestFocus() from another view). Though I (personally) have not experienced any problems with this.
Rather than just using a custom view for your custom keyboard, why not implement a full-fledged IME? That will solve your cursor problem, and even make your keyboard available outside your app (if you want).
This answer has a couple useful links if you want to do that:
How to develop a soft keyboard for Android?
I really wouldn't suggest this. Writing a good full fledged IME is really hard. In addition, users come to expect functionality from their keyboard (auto-correct, Swyping, next word prediction, the ability to change languages) that you won't have unless you spend months on the keyboard itself. Any app that wouldn't allow me to use Swype would immediately be removed (bias note: I worked on Swype android).
But if you want to integrate fully with the OS as a keyboard, you're going to have to write an InputMethodService. Your keyboard would then be selectable by the user in the keyboard select menu, and usable for any app. That's the only way to get full OS integration, otherwise you'll need to really start from scratch- writing your own EditView. Have fun with that, getting one that looks nice is decidedly non-trivial.
Also, setting input type null won't disable most keyboards. It just puts them into dumb mode and turns off things like prediction.
I tried the below answer and it worked, but take care that
1) EditText must not be focused on initialization
2) when your orientation changes while the user's focus is on the editText, the stock keyboard pops up, which is another "solvable" problem.
This was mentioned in a previous answer but take care that you MUST make sure your editText element do not get focus on instantiation:
https://code.google.com/p/android/issues/detail?id=27609#c7
#7 nyphb...#gmail.com
I have finally found a (for me) working solution to this.
First part (in onCreate):
mText.setInputType(InputType.TYPE_NULL);
if (android.os.Build.VERSION.SDK_INT >= 11 /*android.os.Build.VERSION_CODES.HONEYCOMB*/) {
// this fakes the TextView (which actually handles cursor drawing)
// into drawing the cursor even though you've disabled soft input
// with TYPE_NULL
mText.setRawInputType(InputType.TYPE_CLASS_TEXT);
}
In addition, android:textIsSelectable needs to be set to true (or set in onCreate) and the EditText must not be focused on initialization. If your EditText is the first focusable View (which it was in my case), you can work around this by putting this just above it:
<LinearLayout
android:layout_width="0px"
android:layout_height="0px"
android:focusable="true"
android:focusableInTouchMode="true" >
<requestFocus />
</LinearLayout>

Disable suggestions in multiline EditText

How do you disable the autocorrection/autosuggestion features in a multilined EditText?
I tried:
EditText without auto-correction, etc
Android: Multiline & No autosuggest in EditText
How can I turnoff suggestions in EditText?
How to set multiline,firstletter caps and disable suggestions on edittext
How can I turnoff suggestions in EditText?
None of the mentioned methods like "textFilter|textMultiLine|textNoSuggestions" (in any combination) worked, neither declared in XML nor programmatically changed.
It seems that the EditText-box takes either multiline or turned-off suggestions, but not both at the same time.
I think it is important to know that I'm using the HTC Desire HD with Android 2.3.3. I don't have any other device to test this.
Is this behaviour inherent to the HTC Sense UI?
Any ideas?
The inputType tag that you specify in EditText for MultiLine and NoSuggestions are flags that can be ignored by the system depending on its preferences.
But, I can confirm that android:inputType="textNoSuggestions|textMultiLine" in the EditText XML works perfectly fine in Nexus and Motorola smartphones. So am guessing its due to your test device preferences that you are facing this problem.

Navigating Textviews using arrow keys

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.

Categories

Resources