Prevent android from saving and retrieving passwords when typing on EditText

Viewed 2294

How can I prevent this from happening, multiple users are going to use the app on the same device and I do not want all of them having access to some places

enter image description here

3 Answers

You simply just add one property to your editText view

android:inputType="textPassword|textNoSuggestions"

and you are done.

if it is not working for you there is another alternative solution. You can turn off autofill programmatically.

You can try to this.

public class BaseActivity extends AppCompatActivity {

     @Override
        public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           disableAutoFill();
        }

        @TargetApi(Build.VERSION_CODES.O)
        private void disableAutoFill() { 
            getWindow().getDecorView().setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS);
        }
    }

If none of the suggestions worked, like with me, try this as a last resort:

android:importantForAutofill="no"
Related