Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto implement method Kotlin Android

Tags:

android

kotlin

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

like image 208
trna ha minh Avatar asked Sep 24 '17 11:09

trna ha minh


1 Answers

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

like image 72
Abdul Waheed Avatar answered Oct 19 '22 20:10

Abdul Waheed