Android O has the feature to support Auto-filling for fields. Is there any way I can disable it for a specific application. That is I want to force my application not to use the auto-fill service.
Is it possible ?
To block autofill for an entire activity, use this in onCreate() of the activity:
getWindow()
.getDecorView()
.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS);
Is there any better method than this ?
TransactionTooLargeException
s if it tries to autofill something like an EditText with > 1MB of data, which exceeds the limit of a Bundle. See the source forAutoFillManager
. Workaround is to includeandroid:importantForAutofill="noExcludeDescendants"
in the View's xml. – Osier