Phonegap, don't lose input focus when keyboard close - android

I'm using phonegap for develop a mobile application.
I have a search field (an input) and i use http://loopj.com/jquery-tokeninput/.
So, when i focus my input, the keyboard open, i can write a letter, and my script return (or not) a list of user. (Just like examples on my link)
My problem, when i search something and if i close the keyboard, i lose the input focus, so my list of user is closed.
I need a way to, when i close the keyboard (IOS and Android), keep the focus on my input, and keep the value in this input. I just want to close the keyboard, without other effect..
Ideas ?

I have found a solution, i have disabled the .blur event on the code of jquery token input... Easy !

Related

trigger every key press in android in background

i am developing android service and I want to know is there anyway that can let me know what is the user typing every key clicked whatever keyboard he is using
for example if the user clicked the letter 'k' from samsung keyboard, i want my service to know that, I could manage this if the user used my custom keyboard, but I want to know even if he is using his default keyboard. and thank you.
I want to know is there anyway that can let me know what is the user typing every key clicked whatever keyboard he is using
NO, there is no way and it's completely illegal.
However Android let you the opportunity the create a custom keyboard using InputMethodService. Once you have created soft custom keyboard and the user have enabled it then you can track every key of user with the callback method onKey()
Also, let me remind you that this is only for the good intentions like word-suggestions and predictions

Titanium listen for silent input event

I am developing an application that has to listen for input from a hardware QR Code Scanner, and Card Swiper (both HID devices). I want to listen for input and evaluate the input. I was thinking of TextArea input that constantly has focus but I would rather not do that. Is there a simple way any one can think of to have some sort of event listener that is always listening on for input. Also, is there any other way of listening on ports in Android such as /dev/hidraw1...etc? I am able to get the input fine via in a text-area but would be great to listen from a specific device as well.
The only thing that pops in my head is trying to write a native module that implements intent-filters to launch a BroadcastReciever that will take the input and pass it back to your app.
What I ended up doing was actually creating a hidden input field that always has focus and blurring it on input. Listening to the onReturn event on the input ran a onHidInput function, which blurred the input (lost focus), disabled it and processed the data, than gave focus on result. I was originally doing on change but that did every character input when the scan or swipe happened, So I was able to program the devices so they contained a carriage return after input, which allowed me to listen to the onReturn event and get the entire data to process.

Android Dev: Getting key events from onscreen (soft) keyboard

I'm developing an Android program to analyze a user's text input and measure typing speed, error rate, average key presses to enter a single character. By doing so, I can compare characteristics of different input methods. To do this, I need to count and record all key presses made by the user during the text entry process.
For example, a user using a basic qwerty keyboard would have to press at least one key for each letter. However, a user using a keyboard with word completion would need to press fewer keys. But how many key presses are made (on average)? Does word completion actually improve typing speed? These are the questions my program will help answer.
Reading other posts, I know that (by default), onscreen keyboards don't send key events for all key presses. Physical (hardware) keyboards do, but most mobile devices don't have a physical keyboard. I also know that I can implement a TextWatcher to detect when a letter is typed in an EditText field. However, some IMEs might require the user to press a sequence of keys to enter a single letter (or word). I need to handle the intermediate key events (i.e., by counting and logging key presses).
My question: How would I capture every key press event from an IME (even events that don't trigger a typed character) without modifying the IME's user experience (e.g., auto completion, word prediction, T9 disambiguation, etc.)? Is this even possible?
Thanks in advance for your time.
Is this even possible?
Only by writing your own IME, AFAIK, or getting the source to an existing IME and instrumenting it.
did you try to listen for TouchEvents?
did you try to use onKeyPreIme() from View class? with this one you can catch key presses before they are consumed by the IME

Key event handling process

I'd like to know how the key event is handled in Android platform.
From 'when user type key 'a' on software keyboard',
To 'view draw the character 'a' on itself'.
Probably, the key event is generated by IME,
And it will be sent to parent view,
Finally, view(such as EditText) displays chracters.
Please somebody explains about these entire key event handling process.
Take a look at this article: http://developer.android.com/resources/articles/creating-input-method.html
Basically, you can either manually send KeyEvents or you can manually edit and commit text around the cursor in the application's Input View.
These are all done via your IME's InputConnection.
OnKeyListener and OnKeyDown do not get called, as you have discovered, when using a software keyboard. They only get called when using a hardware keyboard, which many Android devices don't even have.
I assume what you are trying to do is capture key events as they are occurring in an EditText area. Your best bet in this case, in order to handle both software keyboard input and hardware keyboard input, is to register a TextWatcher via the addTextChangedListener() method.
Note that on phones with Android 2.1 and later, such as the Nexus One, people have the option of using speech recognition to input text into your EditText instead of typing the text. When they do that you may get full words, or even full sentences, entered all at once. So you need to check the entire contents of the EditText field when there is a change to the contents.

Text Entry on an Android Custom View

I'm dealing with a phone that has no physical keyboard and I'm using my own custom view for rendering. The device I'm working with, by default, seems to be in a T9 type entry mode where it suggests blocks of text. However, it never sends me the actual key events.
How do I tell whatever soft-keyboard that pops up to enter 'dumb' key event sending mode?
The InputMethodManager has a "isAcceptinText()" call which would tell me if it's in event-sending mode, but not a method to set it. Digging through the documentation hasn't produced any insight. How do I tell the input manager that I only want key events?
I think this page has pretty much all there is to say on Android Input method control: Android - Onscreen Input Methods

Categories

Resources