Writing a dictionary application for android.
Want to set translation direction in accord with current input language (to be more precise, language of letters displayed on soft keyboard). For example, we got language pair English-French. What I want is, when user inputs English letters (English keyboard layout displayed) translation direction is straight, and when keyboard layout changes to French, translation direction also changes to inverted.
So, question is: is there any event in an android Input Method Framework, which allows to track this layout changing. If there is not, maybe there is some standard tricks to do what I need?
Thanks in advance,
Alex
As far as I investigated there was no way to do that. So I made a custom keyboard to send a custom event (InputType) to my dictionary application.
Related
how we can specify input language for specific EditText(not for the whole app) any help will be appreciated ..for example, for EditText1, I want to open the English keyboard and for EditText2 want to open some other language any help...
You can't change the user's keyboard. Only system apps can do that.
One possible workaround is to create your own custom keyboard views and switch programmatically.
For this, you have to create separate layouts and classes(extends KeyboardView) for each language keyboard
As far as I know you can't change the user's keyboard, it has to be changed by the user itself.
If you want to control if the user is introducing specific characters (f.e. chinese characters in an EditText), I would use a TextWatcher and apply a Regex pattern to evaluate the introduced String.
Is there a way to find out the current keyboard layout?
I.e.: the typical layout is QWERTY but, e.g., Germany usually has QWERTZ, etc.
Also, I've seen some older Android phones without digits row on the main keyboard page.
Is it possible to find out if the current keyboard layout has also digits row? (Digits row without long touch) And potentially other "non standard" things?
Is there a way to find out current keyboard layout ?
Unless you mean "the keyboard that is visible to the user right this instant", there is no concept of a "current keyboard layout" in Android. A user may have 0-N input method editor implementations available to them, choosing among them as the user sees fit. Plus, depending on circumstances (e.g., inputType hints), an input method editor can display different input options.
Is it possible to find out if the current keyboard layout has there also digits row ?
No.
And potentially other "nonstandard" things ?
No.
In my android application I used EditText to take text input from user.
I want that EditText only accept selective characters, for that in xml file I mentioned following property for EditText.
android:digits="#string/customDigits"
and customDigits is mentioned in strings.xml
<string name="customDigits">\u0022;\u005C;&<>\ abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$%\'()*+,-./:;=?#[]_`{};|~^"*"</string>
I gave multilanguage support for my android applicaton.
When I choose languages like FRENCH,GERMAN,SPANISH and EditText is in focus then it shows proper English keyboard as shown :-
But when I select JAPANESE language and EditText is in focus then it shows Japanes keyboard as shown :-
But I want to show English keyboard by default.
Kindly provide me solution.
You can try
input.setRawInputType(Configuration.KEYBOARD_QWERTY);
But from UX perspective I'd say there's nothing you should be "fixing" here. If user decides he wants Japanese, he gets Japanese. You expect certain characters but it's nothing to do with user language settings nor what type of keyboard he uses. It's none of your interest really - just reject his input if it is failing and ensure that error message (or UI) clearly indicates you expect ASCII (or whatever) to be entered in that EditText.
It may be too late, I'm facing the same issue as you.
I came up with solution imeOptions="flagForceAscii and the keyboard displaying Roman alphabet characters as first priority.
Hope it can help in somehow.
forceAscii
I have some edit boxes in my app, some of them I will input English text, some of them I will input Spanish.
I'm using the standard android soft keyboard, however as my device locale is set to English, when I type Spanish in one of my "Spanish" edit boxes, the English corrective text/predictive text makes this difficult.
The only workaround I've found, is to go into the device settings and change the language over, but this is quite annoying.
Is there anyway I could have some kind of button, that when clicked would dynamically change the soft keyboards language setting? Is this exposed via any Intents?
Regards
Try to slide your finger across the spacebar on your keyboard to change languages.
Is there anyway I could have some kind of button, that when clicked would dynamically change the soft keyboards language setting? Is this exposed via any Intents?
No, sorry.
However, you can use textNoSuggestions with your android:inputType attribute on the EditText to try to get rid of the suggestions.
In the main phone settings you can choose input languages and then you can swipe the space bar to switch.
Why does Gesture Builder pop up with Mandarin/Japanese predictive text when entering the name of a gesture, and then subsequently save that name in this language. Please help me set it back to English? all the dialogue on screen apart from that is in English???
Sounds similar to this answer:
Why is my Android emulator keyboard in Chinese character mode?