While trudging through a situation like the RecyclerView/custom adapter, sometimes I just bit the bullet and wrote everything in Java, then used the “Convert Java File to Kotlin File” functionality in Android Studio (under the Code menu). Convert Java File to Kotlin File = Life Saver. One example I can think of where this happened for me was in hooking up a RecyclerView to a custom adapter and item click listener. This can be pretty frustrating when you just want to create something that you have done hundreds of times in Java, but can’t figure out how it works in Kotlin, and the few examples you come across online don’t quite apply to your situation. The Kotlin official documentation is amazing, and there’s a great Kotlin/Android introduction on that recently came out, but there is not much out there for specific questions you may have about working with Kotlin in Android.
0 Comments
Leave a Reply. |