Controlling the input language keyboard programatically from the android app. - android

The problem is that when I change the language of my android device to Hindi, it changes the keyboard to Hindi as well.But I want that the app should appear in Hindi but English keyboard should always open inside the app.I want that it should be done programatically through the app instead of changing the devive settings.

No you cannot. Android has restricted this for security reasons. If you can manipulate the input method, you can do things like key logging, hence tampering privacy. You could however use the InputManager and let the user select an input method:
InputMethodManager ime=(InputMethodManager)getActivity().getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if(ime!=null) {
ime.showInputMethodPicker();
}
But the above code will only show the active keyboard set the user in Settings.

Related

Android: Nougat (Huawei Honor 6x) : Urdu text not displaying correctly

Urdu/Arabic Text is scrambled every where in the operating system ever since I have updated my Huawei Honor 6x from Marshmallow to Nougat. Screenshot is attached. Even when i type the urdu text, incorrect text is typed.
There is no option in the OS to add Arabic language.
What can be the possible solution except downgrading?
Just follow above steps:
Download and install GO Keyboard from the Google Play Store
Open the app and follow the on-screen steps to enable and switch to GO Keyboard.
Urdu Keyboard on Android Phones
After you enable it, go to “Input Settings” in the app and then go to “Input language settings”.
Scroll down till you see Urdu (in Urdu font).
Urdu Keyboard on Android Phones
Check the box. A popup box will open to download the language files. Tap the ‘Done’ button.
Urdu Keyboard on Android Phones
Download “Urdu for GO Keyboard” app from the Android Market.
Urdu Keyboard on Android Phones
Now open any app for text input (i.e. Messages) and pop open the keyboard.
Tap the ‘EN’ key on your GO Keyboard and it will change to Urdu keyboard.
Urdu Keyboard on Android Phones
I hope this tutorial was helpful to those who want to type in Urdu on Android phones.
GO Keyboard is not the only app which allows you to type in Urdu. MultiLang Keyboard also has Urdu language support.
finally factory reset worked,
{SOLVED} Called huawei support, they suggested the following working solution. After the successful update, if user is facing this language related issue. Again Factory reset should be done wiping Internal Storage as well. (backup should be done before that if necessary) This solved problem.
After the update. Performing a reset again solved the issue.
Note: Please backup your data before doing so.

How to open Android Keyboard in Speaking mode programmatically?

I want to open the Android Keyboard in Speaking mode by default programmatically when I focus on editText.
I know android:inputType="voice" is in enhancement, is there
another way?
I don't want to use SpeechRecognizer because the difference with the one used by default in Android keyboard is that it works offline.

Disable speech to text button (Micro phone) on soft input keyboard in android programmatically

Thanks in advance for the help.
I am developing an android application for research purposes and need to disable the speech to text button on the soft input keyboard. The reason for this is due to concurrency issues that arise since the application I am developing uses the microphone. I understand that for a general application disabling keys is generally seen as impossible (since users may change default keyboards). I know for a fact that the default keyboard will be used.
With this in mind is it possible to disable certain keys? I believe that at the least I should be able to specify the input type such that the microphone button is hidden. I say this because if I disable speech to text in the settings (not programmatically, but manually as a user) the microphone icon is removed from the keyboard. I'm open to any possible solution (with the exception of not using the default keyboard) as this application will not appear on the play store.
You can't force the user input through anything other than pre-defined keyboards that already exist in the user's device.
The only way you could get around this is by programming your own custom, on-the-fly keyboard, and that is a very bad idea.
Just disable voice input programmatically by using XML declarations in the EditText you're looking at. You can do this with the attribute:
android:privateImeOptions="nm" // nm stands for No Microphone.
If you want to set it programmatically you can try this::
// deprecated i guess
edt_txt.setPrivateImeOptions("nm");
// this one is new but it works only with Google Keyboard.
edt_txt.setPrivateImeOptions("com.google.android.inputmethod.latin.noMicrophoneKey");
You can combine values in PrivateImeOptions parameter in CVS form so best option is to use:
edt_txt.setPrivateImeOptions("nm,com.google.android.inputmethod.latin.noMicrophoneKey");
Take a look through here and see if you can find what you're looking for.
More info about Google Keyboard here -> look for method setOptions
To disable microphone button on multiple keyboard. Use property
android:privateImeOptions="nm"
But it will not work for Gboard(google native keyboard)
To disable on microphone on Gboard use
android:privateImeOptions="nm"
editText.setImeOptions(IME_FLAG_NO_PERSONALIZED_LEARNING)
Just use this in your editText on the layout file:
android:imeOptions="flagNoPersonalizedLearning"

Per-application input setting on Android Device

Android keyboard has a button that switches the input language. How can I change the input language
programmatically without using this button? My app has different textboxes where the user enters information in different languages and when the user switches from one field to another the input language will be changed automatically to the correct one.
Android keyboard is a stand-alone application, so I need to manage this language changing from my application. The only thing that I found is switchToNextInputMethod() method in InputMethodManager class but I'm not sure if it fits.

Get state of soft input keyboard on Android

I have an EditText in my Android app, with a normal keyboard attached to it, e.g. there are no custom filters, or other restrictions set on it. I would like to find out if the user uses the QWERTY keyboard, or she switched to another type, for example to the one where the numbers are displayed, and other special characters. Is this possible?
Thanks.

Categories

Resources