trna ha minh trna ha minh - 23 days ago 9
Android Question

Auto implement method Kotlin Android

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

Answer Source

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 code tab from right panel that is on the top 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