Search code examples
androidandroid-studiokotlincode-completion

Kotlin auto complete overrides in Android Studio


I have this variable defined in a Kotlin file, but Android Studio doesn't suggest implementing methods, am I missing something :

private val mGestureListener = object : GestureDetector.SimpleOnGestureListener() {

}

Solution

  • SimpleOnGestureListener is a non-abstract class. Hence the IDE doesn't show the Implement methods options by default. The IDE shows this option only when there is at least one method that's not implemented in the class.

    If you want to show the Override methods option, then place the cursor inside the braces and choose Code -> Override Methods... (Ctrl+O), or if you already know the methods that you want to override, just start typing the method name and it will show up in auto complete.