androidkotlinmaterial-componentsrecreatetextinputlayout

TextInputLayout hint doesn't get refreshed upon recreate() method call


I'm using TextInputLayout. I set it's hint from string.xml to apply localization. So after changing the language from the drop down I use recreate() method which refreshes the whole activity components with selected language resources but TextInputLayout hint doesn't get a refresh.


Solution

  • Update July 2022

    Starting from material version 1.7.0 the bug should be fixed.


    This is known bug of material library TextInputLayout already reported here.

    PS: A possible workaround is to manually call textInputLayout.setHint(R.string.your_string) again on onRestoreInstanceState to update the text. (call it after super.onRestoreInstanceState(bundle)) or call it in onViewStateRestored