I am setting up a log in activity, with username and password. I want to disable the user name and password edit text fields whilst the app is trying to log the user on to the system.
signInButton.setOnClickListener(view -> {
valueAnimator.start();
loginView.setEnabled(false);
loginView.setFocusable(false);
loginView.clearFocus();
passwordView.setEnabled(false);
passwordView.setFocusable(false);
passwordView.clearFocus();
I want to then re-enable/activate the edit text fields if the sign in fails or is unsuccessful. I've followed the instructions on a few similar questions, but whenever I try and allow the fields to be editable again, the cursor and keyboard don't appear again. I can long click on the fields, and the cursor will appear, but won't allow any editing or change, without exiting and going back into app.
passwordView.clearFocus();
loginView.clearFocus();
loginView.setEnabled(true);
// loginView.setFocusable(true);
loginView.setClickable(true);
loginView.isFocusableInTouchMode();
passwordView.setEnabled(true);
// passwordView.setFocusable(true);
passwordView.setClickable(true);
passwordView.isFocusableInTouchMode();
loginView.setCursorVisible(true);
passwordView.setCursorVisible(true);
loginView.requestFocus();
<EditText
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_login"
android:focusable="true"/>
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_password"
android:focusable="true"
android:inputType="textPassword"
android:visibility="gone" />
Currently using Android Studio 3.1.4, with
compileSdkVersion 28
defaultConfig {
applicationId "co.***.app"
minSdkVersion 21
targetSdkVersion 27