When locale changed to Hindi language, app not accepting inputs from softinput keyboard. Following code is working fine for English. Please let me know where its went wrong.
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/farmer_phone_number_layout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dimen_10"
android:hint="@string/mobile_number"
android:inputType="phone"
app:endIconMode="clear_text"
app:errorEnabled="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/farmer_phone_number_edt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:digits="@string/input_digits"
android:imeOptions="actionDone"
android:inputType="phone"
android:maxLength="@integer/max_length_mobile_number_at_india"
android:textColor="@color/black" />
</com.google.android.material.textfield.TextInputLayout>
Using the below code, I am trying to change the locale of the app.
public static Context updateResources(Context context, String countryCode) {
Locale locale;
locale = new Locale(countryCode.toLowerCase());
Configuration conf = context.getResources().getConfiguration();
conf.locale = locale;
Locale.setDefault(locale);
conf.setLayoutDirection(conf.locale);
context.getResources().updateConfiguration(conf, context.getResources().getDisplayMetrics());
return context;
}
By Rajan.Kali answer, On removing the following statement app working fine.
`android:digits="@string/input_digits" `
android:inputType="phone" is working fine in Hindi locale.