I am working with a bar code scanner and java currently. i wanted to know wether there is a possibility to poll this device.
What I want: a popup message every time you scan a barcode
What I dont want: is to focus a text field first to do so.
I want this to run in the background so that the user only has to scan something without anything in focus. is this possible?
in other words, i dont want to use it like a keyboard but more like a sensor that informs me every time a new value is available.
thank in advance
i think these mostly work as keyboard input.
you could probably create a KeyListener() to check for the incoming values.
Yes you can listen barcode scanning detection on your whole hardware at anytime example:PC or Laptop or Tablet etc.
For that you need to add barcode scanner listener on your main file which is available to all the pages or all the urls of your application.
You can use my custome script from my answer on stackoverflow
Related
I have an editText that needs to be of the "text" type, but I want that when it gets focus my Android keyboard opens showing the numbers first, instead of the letters that are the default.
I've been researching for a while now, but I can't find an answer. Could anyone tell me if it is possible to do this?
PS: setting my editText to "number" doesn't get me the result I need.
EDIT
I need my keyboard to have this behavior when opening: https://streamable.com/2ohsaz ; that is, the user can type whatever he wants, but the numeric keypad option must appear first
No, there isn't. THe keyboard is a separate app, and it gets to decide what to show. There's an API to provide hints to the keyboard, such as NUMBER to tell it that it should show numbers. But there's no API to tell it to show certain information at certain times. You can try to hack it by setting the input type, but it will be more likely that a keyboard will ignore or be confused by changing input types, because they aren't actually supposed to change until a new field is focused.
Because the keyboard is a separate app that isn't part of the OS and is frequently replaced by OEMs and users, you can't require special advanced behavior like that- the API between the app and the keyboard just isn't set up to allow that, and is mostly guided by conventions and expectation. So any advanced trickery you use will work on some devices, and may totally break others. As such its recommended that other than setting an initial input type, you let the keyboard do what it wants.
I am writing a Java application that uses both Scanner and Console to get input from the user. I would like to add command history support so that the user can use the ARROW KEYS to search previous inputs (similar to a terminal). Is there a way to do this? Right now, when I use either the Scanner or the Console, I get weird symbols like ^[[A when pressing the arrow keys.
I have read about KeyListener and KeyEvent, but my application does not use a GUI.
Thanks!
Good question - +1'd. On Windows, I would SetConsoleMode to change the console to take raw input, but on *Nix it looks like there is more work involved. Unfortunately I don't have any code that I can show you right now, but have a look at this link and see if it helps.
http://www.darkcoding.net/software/non-blocking-console-io-is-not-possible/
I'm currently building a small game for Android using LibGdx in Android Studio. In the game the player uses the on-screen keyboard to enter different letters one by one.
My problem is that the autocomplete is one (since I use it when I'm texting) and this forces the player to click the "suggestion box" after every typed letter to actually make sure that the keyboard press and character input is registered. Since the input in my game should be one letter at a time I don't want autocomplete to try to "guess"/create a word.
I'm using the InputProcessor class with the "keyTyped(char character)" function. If I turn of the auto complete in phone settings (manually before starting the game) the input is registered and the correct character is passed in.
So, my question is if there is any way to turn off/toggle autocomplete programmatically?
Thanks in advance!
I realise this is old but if you or anyone else is looking for a way to do this then I have a solution. I built a completely new method for Android soft keyboard input to tackle the issues involved with the current libgdx methods. I am surprised to read auto-complete was actually working for you, because on all my testing devices it does not, and this is one of the problems I have attempted to solve.
I have built a sample project for people to work with that allows for much more reliable input using the Android soft keyboard, this includes swype, auto-correct, dictionary, etc. What you may be interested in is I have also included some customisation for the keyboard, such as the ability to disable auto-complete and suggestions. You would simply customise your TextFieldStyle with;
textFieldStyle.androidKeyboardAutoCorrect = false;
textFieldStyle.androidKeyboardTextSuggestions = false;
As of posting, no one has used this sample project and I have only tested on a few devices, so it may be a little erroneous. I will carry on maintaining it when/if feedback is received.
You can find it on Github here (source and executable apk)
If you have any comments/feedback please refer to Github or the badlogic forum topic
Hope this helps!
Hi I want to capture all the keypress events of keyboard happened in perticular session using java program. same like keylogger.
any help would be appriciated.
Maybe you could need a library like the following:
http://kra.lc/blog/2011/07/java-global-system-hook/
It even tracks keypress events if focus lost of an element.
Not sure if I'm asking this question on the correct site (I have been wondering if this should rather be posted on the EE.stackoverflow site).
So I have an OLD serial input mouse, and I want the system to reprogram or retranslate it to a keyboard button-press.
The whole thing is that I have software with shortcut keys, but remembering all of them is just not possible. So, why does one want to have a whole keyboard when one can only have a set of three buttons? Using a keyboard, when one presses F11 (and holds it in), it activates the system's mic. While holding in F11, one wants to press F1 to start playing music, thus being a voice over song application.
I've been trying to research the possibility, and I've come to notice that there are a LOT of applications that can convert a USB device, such as a game controller to a keyboard button-press. That's what's driving my concept.
Is this even possible?
Thanks,
Johan Brink
Well, as described here, if you are using Windows, you can use X-Mouse Button Control for mouse. If you want to use gamepad, try J2K - A Joystick to Keyboard Mapper 1.1
Have a look on Makey Makey (www.makeymakey.com). This is a board which emulates a key stroke each time one of his input is closed.