LibGdx Android Keyboard Autocomplete - java

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!

Related

Converting Serial input to Keyboard Button-press

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.

Android Paste onClick

pretty simple question here but I cant seem to find anything. Anyway, There is a game on android and with a keyboard you can enter a cheat id like to use(personal use not uploading to market) . Well I created a static button that remains on-top of all activities. Id like to just click my button and have it paste the word to the game so the cheat will be entered. Anyway to paste onclick? I cant see this being hard
You can't make other apps behave in a different way than they do as it violates the whole sandboxing idea of android (unless of course the app itself allows it in some way or another) .
What you can do is to copy the content to the clipboard , and allow the user to paste it anywhere he can .
More info about it here:
http://developer.android.com/guide/topics/text/copy-paste.html
There might be root solution , but like many root operations , i really lacks this knowledge of how to do it.

how do i create a cocos2d particle effect in cocos2d android 1?

I'm using the android version of cocos2d located here:
https://github.com/ZhouWeikuan/cocos2d
I'm an iPhone guy checking out android who already has familiarity with cocos2d iPhone. Ideally i would be able to create the particle from a plist file in the package/bundle. I can't seem to even get the "premade" default style particles working ie CCParticleFireworks (I've only tried in the simulator though). I was disappointed that there is very little sample code out there for cocos2d android so if anyone has a good resource on this I would be interested as well. I'm just learning java as well so it may be something simple just looking for some code snippet I can use basically.
The behavior im seeing with all my attempts is just a crash as soon as i try to instantiate and add the particle to the scene. I'm not too great at debugging in eclise either so i can't say exactly when the app is dying. sorry. I'm trying to suck less. I'd put my code in but ive tried it a bunch of different ways and I don't want to look like an ass. but here goes anyway, so here's how i think it should work:
public boolean ccTouchesBegan(MotionEvent event)
{
CGPoint location = CCDirector.sharedDirector().convertToGL(CGPoint.ccp(event.getX(), event.getY()));
CCParticleSystem part = CCParticleSystem.particleWithFile("0.plist");
part.setPosition(location.x, location.y);
addChild(part);
return true;
}
0.plist is in my assets folder, i feel like i need to turn this into a hash or something. also i feel there might be a problem with the ccparticlesystem vs ccpointparticlesystem vs ccquadParticleSystem.
You should try WiEngine . It is the Best Cocos2d java android port. Cocos2d-android don't even have 3d implemented. The classes are there but empty. Also check Wiengine's api Demo from the android market
Last time I checked with the author he mentioned that scene transition, grid actions, and particle systems on cocos2d-android-1's 3D are flawed.
I would recommend trying cocos2d-x if you have cocos2d-iphone code to port or coding your own thing extending View.

JTextArea Real Time Spell Checker

I need a good spell checker library for Java that can spell check a JTextArea (or any JTextComponent) in real time. That is, it should have a wavy red underline appear under text while the user is typing.
It needs to be able to list all the available word replacements by left clicking (yes, left clicking) the word. If not possible, right-click is fine.
It needs to have an "Ignore All," but not an Add, Ignore, or any of the others. Just Ignore All.
Ideally, you should be able to change how the dropdown box looks, at least to some extent.
No user-spell checker is needed. That is, I don't need a button that when you click it brings up a spell check dialog, I only need real time checking. I actually already have a spell checking dialog library.
If someone can suggest a good library (I am willing to pay for it) or, better yet, explain a good method for doing this to a textarea in the first place that would be fantastic.
At the very least if someone could explain how to check the JTextArea against my dictionary and put the red underline and the dropdown on clicking or any of these steps that would be a great start.
Thanks for the potential help.
http://jortho.sourceforge.net/
Sample can be seen here
http://www.inetsoftware.de/other-products/jortho/sample
Trying to make a complete list. Feel free to add.
Full-blown solutions
JOrtho
Wordlist comes from Wiktionary
JaSpell is a Java implementation of the popular Aspell.
JMySpell
Uses the OpenOffice.org dictionaries
Wintertree
non-free
Libraries
HunspellJNA used as backend by LanguageTool
Jazzy
JSpell SDK can be used as basis
LanguageTool also includes a Grammar check
a small wrapper application is shown at https://github.com/pminos/languagetool-wrapper-demo-parent
Suggester
Decided to go with Wintertree

What equivalent in MIDP programing to the JButton of swing-application?

In swing(GUI) application I used JButtons.
Now I need the same application in MIDP and I'm conuse...
I need Idea for what to use with and an example of how to use it and what kind of listener might possible fits.(Because I need to refresh the shown screen after every click on a button)
And one more question: I use Netbins with the simulator of cell-phone.The screen is very tiny,
so is there any way to make this screen larger,In case I need to show something too width?
Lets say,something like 11-15 buttons...
I don't think there's anything that's exactly equivalent to a JButton, but I think you could solve your problem by implementing a Command though. I found a lot of examples:
MIDP Programming with J2ME (This one is a bit long. It's actually an entire chapter from a book and the Command example starts on page 4.)
Enterprise J2ME: developing mobile Java applications (Also a book, but I linked to the relevant section.)
J2ME Programming (Part I) (I like the CommandProcessor.java code example in this one.)
Visual Mobile Designer Custom Components: Creating Login Screens
Add Command to MIDlet (This one has the shortest and clearest example code, but it unfortunately doesn't have a screen shot of the final result.)
And one more question: I use Netbins with the simulator of cell-phone.The screen is very tiny, so is there any way to make this screen larger,In case I need to show something too width? Lets say,something like 11-15 buttons...
There is a way to choose an emulator with larger size screen. Last time I checked, Netbeans documentation had instructions on how to do that.
Though, before doing so, I would recommend you to find out whether the real device you're targeting will have such a screen. Because if its screen will be as tiny as the default emulator then your UI might look totally different from what you designed with large size emulator.
Take for example 11-15 buttons you mention - do you expect real device to have screen large enough to display these conveniently for user?

Categories