Skip to content

Instantly share code, notes, and snippets.

@sliskiCode
Last active November 23, 2016 13:56
Show Gist options
  • Save sliskiCode/fe880793f7b4b8f962d952e42e823349 to your computer and use it in GitHub Desktop.
Save sliskiCode/fe880793f7b4b8f962d952e42e823349 to your computer and use it in GitHub Desktop.
7 things you probably don’t know about Kotlin #3
// Using in Java
CustomButton button = new CustomButton(context);
button.setVisibility(CustomButton.Companion.getGONE());
// Using in Kotlin
val button = CustomButton(context)
button.visibility = CustomButton.VISIBLE
class CustomButton(context: Context?) : View(context) {
companion object {
// Visibility
val GONE = 1
val VISIBLE = 2
val INVISIBLE = 3
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment