// Step 1: Import necessary packages
import android.os.Bundle
import android.view.autofill.AutofillManager
import android.widget.EditText
class YourActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// Step 2: Get the EditText view
val editText = findViewById<EditText>(R.id.editText)
// Step 3: Disable autofill for the EditText view
editText.importantForAutofill = EditText.IMPORTANT_FOR_AUTOFILL_NO
// Step 4: Get the AutofillManager
val autofillManager = getSystemService(AutofillManager::class.java)
// Step 5: Disable autofill for the entire activity
autofillManager.disableAutofillServices()
// Optional Step: If you want to enable autofill for the activity again
// autofillManager.enableAutofillServices()
}
}