Android EditText with Swype Keyboard typing issues - android

I have a user that is having problems when she attemps to type in my app. The device she is using is the Motorola Electrify running Gingerbread and she is using the Swype Keyboard on her phone. When she attemps to add text to an existing item it just overtypes unless she uses the Swyping gestures to build the words.
Just to be clear I dont have any listeners coded that are cauing this. I have tested with the other stock keyboard on her phone (Multi Touch) and everything seems to work fine.
An example of what we are seeing: Press A the A appears on the screen then you press n it replaces the A.
Here is the layout for the edit text:
<EditText
android:id="#+id/editor_text"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="0.72"
android:gravity="top"
android:inputType="textMultiLine|textCapSentences|textAutoCorrect"
android:singleLine="false" >
</EditText>

So I was the lead Android developer for Swype until May of this year. So I'll do my old friends a solid and give some free tech support. What version of Swype is she using? And is she doing anything funny with inserting her own text into the edit text or losing focus from the edit box? If she turns off predictive text does it still happen?
The problem she mentions sounds like a problem I saw with some custom implementations of EditText where they did not properly implement getExtractedText and our predictive text solution expected to be able to retrieve the previously typed text from the editor (to work around a variety of bugs in yet other apps). But if you're using a stock EditText that shouldn't be the case. Let me know the answers to the above and I'll see what I can drag out of year old memories.

Related

Android empty bar on top of the keyboard

I need help and i'm hoping someone knows a solution. I have a textfield in my app with disabled suggestions and no microphone icon -> without any bar over the keys.
It works like a charm, until i change the keyboard to the numbers and special characters (Screen below). There is an empty bar on top of the keyboard. Do i have a chance to have the keyboard without the bar at all views? (Android 6.0.1)
My code of the textfield:
<EditText
android:id="#+id/without_gb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:inputType="textNoSuggestions"
android:textColor="#000000"
android:textSize="25sp"
android:imeOptions="flagNoExtractUi"
android:privateImeOptions="nm"/>
I already tried adjustPan and adjustResize... nothing worked:(
THis is most certainly a bug or intended behaviour of this specific soft-keyboard. You should not rely on the users keyboard, every device might have another keyboard installed or activated. Do not try to fix the problem with text-input inside your app, declare your inputs as desired and rely on the keyboard implementation to do the rest. Any kind of workaround or hack might break your application for other input methods.

Android Keyboard with Emoji

So I want to have a keyboard in my app that has emoji just like Whatsapp or Hangouts. How can I do that? I want to leave my key keyboard as it is I just want to add tabs to put emojis. I would think it would be easily supported by the soft keyboard but I can find nothing so far. Anyone could tell how to do it?
UPDATE:
The keyboard with emoji is included in Android KitKat and can be accessed by long pressing the new line button in the keyboard. The Hangouts keyboard however has the emoji icon visible instead of the "new line" key. If someone knows how to make this the default (either in layout or programmatically) I will take that as the correct answer.
As #dbar pointed out, the answer is:
android:inputType="textShortMessage"
But in my case, I was already using textMultiLine, so I had to use the both of them together:
android:inputType="textMultiLine|textShortMessage"
Looks like this:
I'm not sure about the Exact android version, but this should work only on Android 4.1 and above
Finally the answer was:
android:inputType="textShortMessage"
The new line key becomes a key to take out the emoji keyboard. The only quibble is the 'new line' key from the keyboard disappears with this configuration (before you could long press to choose between emoji/new line but now it's only emoji).
In Google Hangout, the emoji button is not on the keyboard (at least on my phone which is already using a third party keyboard), it's inside of the TextEdit box, and so it's part of the application itself (Gabe, I'm talking about the latest Google Hangout on top of KitKat with emoji support, all the current screenshots I found of Google Hangout do not show what I'm seeing on my phone, so this must be a very recent feature).
This is actually pretty easy to do, placing an ImageButton to the right of a TextView inside a RelativeLayout (the RelativeLayout which is made to look like a TextView with a custom background).
Then, it's just a matter of hiding the keyboard when clicking on that ImageButton and replacing it with a panel full of emojis when that happens (like in this open source emoji android keyboard, which is under a creative commons non-commercial license).
There is no functionality to add tabs to any generic keyboard. Certain keyboards may support it, but it isn't a common feature. You could write your own fully custom keyboard, but that's a lot of work and will piss off many users.
Also, I'm not sure what you mean about by like in hangouts. I use hangouts- it doesn't do anything odd with my keyboard. It stays as Swype, there's no special emoji tab. It may be a feature of your favorite keyboard based on the input type (I assume both use input type textShortMessage). But it isn't a generic feature.

Little annoying keyboard issue with edit text

I'm new to Android/Java ... I created some basic application with basic widget, and i have an issue with EditText, here it is:
I create a normal EditText, nothing special format:
<EditText
android:id="#+id/etEmails"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</EditText>
This EditText is on top of the activity's content view, so whenever i open this activity, the EditText is "activated" (ready to get some input) so the keyboard is showed up on the screen, blocking lots of visibility.... Assuming i want to see some information below the EditText before actually edit it, then it's very inconvenient
If you don't get what i mean, the example is Google Translator app, it has a EditText on top of it, and it won't show up the keyboard in the first place, you have touch the EditText to "activate" it (NEWEST VERSION, older version has the same issue as i mentioned)
Please add
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
in your onCreate() to make sure the keyboard only pops up when a user clicks into an EditText

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>

Android Phone EditText not updating the display on the device

I've got a small Android app that I am developing and I have an EditText element which does not like to display it's contents while the keyboard is on the screeen.
For example I touch the editTextbox and it brings up the keyboard, pressing a letter, say a displays a in the textbox, but after that no new text shows up so the user is essentially typing blind from that point on.
This only happens on the device and not in the emulator. Vodafone 845 if it makes any difference.
The code I am using for the EditText is this.
<EditText
android:id="#+id/EditAddress"
android:layout_width="200px"
android:singleLine="True"
android:hint="Address or Landmark"/>
I did have a OnKeyListener and an OnClickListener, but removing them from the code makes no changes to the behaviour. The EditText is also inside of a TableLayout which is inside of another TableLayout. This is the only EditText that is behaving badly on the device. (I have not coded any others in the application. But might add some just to find out whats wrong.
EDIT: Ok, it seems to be caused if the keyboard obscures the location of the original editbox such that the view has to scroll down so the editbox will not be covered by the software keyboard. For now I can rearrange my page so the edit box is at the top. But this is a bit of a hacky solution. Anyone know what causes this and/or how to fix it.
I think you need to give it a layout_height as well. Even if it is wrap_content or the like.

Categories

Resources