Sumant
Sumant

Reputation: 2795

Change Input method of android device programatically android

I am developing one small application in android which consist of an Edit Text & Button. Button will be visible only after edit text is not blank.Since I am having LG Optimums Android device, Whenever i click on Edit Text since it it LG device, LG Key Board will appear but i don't want that Key Board i want Android Key Board to use. I Also know that i can go into Setting=>Language & Key Board & i can change that Key Board. But i don't want to use that i want it should be done only through coding.

Thanx for any Help.....

Upvotes: 7

Views: 17489

Answers (4)

Noor Hossain
Noor Hossain

Reputation: 1831

Change the keyboard from your app on Button Click :

             Button keyboard = (Button) findViewById(R.id.keyboardChange);
    keyboard.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view)
        {  InputMethodManager imeManager = (InputMethodManager) getApplicationContext().getSystemService(INPUT_METHOD_SERVICE);
            imeManager.showInputMethodPicker();
        }
    });

Upvotes: 0

pennetti
pennetti

Reputation: 135

Like Paul said you cannot change the IME; however, you can disable the android softkeyboard by hiding it

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

then create a view that resembles an android softkeyboard. Check this out.

Upvotes: 2

Cristian
Cristian

Reputation: 200080

It's not possible to change the keyboard settings for the user programmatically. The only thing you can do is advise the user to change it and help it to do so. For instance, this will show a dialog for them to change keyboard:

private void showInputMethodPicker() {
        InputMethodManager imeManager = (InputMethodManager) getApplicationContext().getSystemService(INPUT_METHOD_SERVICE); 
        if (imeManager != null) {
            imeManager.showInputMethodPicker();
        } else {
            Toast.makeText(this, R.string.not_possible_im_picker, Toast.LENGTH_LONG).show();
        }
    }

Upvotes: 17

Unpossible
Unpossible

Reputation: 10697

As far as I've seen, and from an Android employee here, it is simply not possible to change the IME programatically - it is completely dependent on the end-user to choose their preferred IME.

Upvotes: 2

Related Questions