0

when user input edittext. I want to set soft Keyboard can't change language.

How to set it ?

thanks!

ARR.s
  • 769
  • 4
  • 20
  • 39
  • 5
    Possible duplicate of [Change Keyboard input language](https://stackoverflow.com/questions/12303593/change-keyboard-input-language) – Manohar Sep 11 '17 at 04:30
  • also check out https://stackoverflow.com/questions/36261166/change-keyboard-input-language-programmatically and https://stackoverflow.com/questions/38569922/change-keyboard-language-programatically – Manohar Sep 11 '17 at 04:31

1 Answers1

-1

Maybe this can help you.

public class LocalizationUpdaterActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        private String[] languages = { "Inglese", "Italiano", "Francese" };
        Spinner spinner = (Spinner) findViewById(R.id.spinner1);
        spinner.setPrompt("select language");

        ArrayAdapter<string> adapter = new ArrayAdapter<string>(this,
        android.R.layout.simple_spinner_item, languages);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinner.setAdapter(adapter);

        spinner.setOnItemSelectedListener(new OnItemSelectedListener() {

            public void onItemSelected(AdapterView arg0, View arg1,
                                        int arg2, long arg3) {
                Configuration config = new Configuration();
                switch (arg2) {
                    case 0:
                        config.locale = Locale.ENGLISH;
                        break;
                    case 1:
                        config.locale = Locale.ITALIAN;
                        break;
                    case 2:
                        config.locale = Locale.FRENCH;
                        break;
                    default:
                        config.locale = Locale.ENGLISH;
                        break;
                }
                getResources().updateConfiguration(config, null);
            }

            public void onNothingSelected(AdapterView arg0) {
                // TODO Auto-generated method stub
            }
        });
    }

    public void onClick(View v){
        startActivity(new Intent(getBaseContext(), TextActivity.class));
    }
}
Pang
  • 9,564
  • 146
  • 81
  • 122
  • That wouldn't change the keyboard's language, as keyboard language isn't something in the Android API at all- its something the keyboard apps came up with, and there's no way to interact with it. – Gabe Sechan Sep 14 '17 at 19:57