I'm writing an app that has a few EditText fields. The app has been tested on many different devices with different Android versions and everything went as expected, except on a Xiaomi Mi9 with Android 9 and MIUI Global 10.2.30 stable. On this device, when I click the first EditText, the app stops working, the smartphone locks and appears a message stating that the device has unexpectedly closed.
The odd thing is that I have several EditText fields that are working fine, only the ones for login are causing the problem.
Debugging in Android Studio doesn't show any errors, it's like the app is working fine.
Does anyone know what can be causing this? Has anyone experienced similar issues with this device/MUIU?
Below is my Java and XML code (the same code works well with other EditTexts):
public void onLogin(View v) {
EditText etUsername = (EditText) findViewById(R.id.username);
EditText etPassword = (EditText) findViewById(R.id.password);
sendLogin(etUsername.getText().toString(), etPassword.getText().toString(), new VolleyCallback(){
Layout
<EditText
android:id="@+id/username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/design"
android:ems="10"
android:fontFamily="monospace"
android:hint="@string/hint_login"
android:inputType="text"
android:padding="10dp" />