setTheme() in Inputmethodservice class

259 Views Asked by At

I am trying to test different themes on custom keyboard using setTheme() method. I got it that it should be called before onCreate but when i call settheme like this it's taking no any effect.

public class MyInputMethodService extends InputMethodService{
...
    @Override
    public void onCreate() {
        setTheme(R.style.ThemeDark);
        super.onCreate();
    }
....

}

Then I tried with inputview's onCreate method like this:

@Override
public View onCreateInputView() {

    this.setTheme(R.style.ThemeDark);

    initPanels();
    this.keyboard = keyboardView;
    return keyboard;

}

It's giving me the same error: Must be called before onCreate()

Where should I call the setTheme() method to apply the style to entire inputview in service class?

0

There are 0 best solutions below