androidpreferenceactivityedittextpreferenceimeoptions

setImeOptions in EditTextPreference


I have a Settingsactivity (big backwards compability needed), where I add items from xml, and some programmatically.

So far it worked fine, but now I faced a problem again. In xml I was able to set "setImeOptions" for EditTextPreference, but programatically, I can't. Android Studio tells me, there is no such method, when I try.

I hope someone can help me.

kind regards


Solution

  • I finally found the answer: Hope it can help some devs.

    In my case, I had a general Preference, which I instanced according to other options, so I had like:

    Preference myPref = new EditTextPreference();

    How I got the IME options to work:

    EditTextPreference myEdTePref = (EditTextPreference) myPref; myEdTePref.getEditText().setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);