8

When I implement methods from interface by hitting Alt + Enter, the implement method should be at the bottom of class. But in Kotlin, it stays on the top (as you can see the method showToast). It is inconvinient because it is above onCreate and I also want to remove the //TODO comment when I implement methods automatically!

And normally, when I write logi in Java, Android studio automatically generates Log.i(TAG, ..) but it seems not to work in Kotlin

Can anyone show me how to do that. Thanks

enter image description here

trna ha minh
  • 243
  • 2
  • 11
  • For the position of the implemented method: [here](https://stackoverflow.com/questions/45350594/kotlin-how-can-i-let-android-studio-implement-interfaces-function-at-bottom-of); For logi template: [here](https://stackoverflow.com/questions/44556828/logd-shortcut-doesnt-work-in-intellij-with-kotlin); For auto-generated TODO statement: You may follow the instruction of the comment and find the setting of "New Kotlin Function Body". – BakaWaii Sep 24 '17 at 12:01

2 Answers2

10

To avoid Todo comment follow below mentioned steps

  1. Go to File -> Setting (That will bring new window in front)
  2. Go to Editor -> Code Style -> File and Code Template
  3. Select the Code tab from the right panel
  4. Scroll down the list of options and find out 'New Kotlin Function Body' option
  5. Remove the default text and done

You will not get any todo comment line in overriding method now. hope that helps you

Allan Veloso
  • 5,823
  • 1
  • 38
  • 36
Abdul Waheed
  • 4,540
  • 6
  • 35
  • 58
0

The issue is still open at JetBrains tracker. Vote and track progress over here

ar-g
  • 3,417
  • 2
  • 28
  • 39