read

Using @JvmOverloads tag helps to avoid multiple constructors with Kotlin

The headache

It’s really possible that you had some code like:

As you can see there are all the constructors needed for a custom FrameLayout but all with same “body”.

The remedy

Refactored with @JvmOverloads:

Thanks to

Blog Logo

Daniel Gomez Rico


Published

Image

MakinGIANTS

The findings and tips records of an Android-iOS-TheWholeShabang group

Back to Overview