This message was deleted.
# android
s
This message was deleted.
c
Not sure where you want that output but you can override the
toString
method.
you are asking in an android channel, so 1. Android does not have a console. it has logcat https://developer.android.com/studio/debug/logcat 2. there is no
print
on android. if you want to log something to logcat use https://developer.android.com/reference/android/util/Log 3. if it was clear I would not have asked 4. if you format all the code it would be easier to follow whats code and whats just a statement. 5. whats hindering you in overriding
toString
?
My answer was
you can override the
toString
method.
🙌 1
and that the only way you can overwrite what’s “printed” anywhere.
the rest was just info for you. seem’s you are not an experienced android developer.
Just because something “works” doesn’t necessarily mean you should do it.
Hey, be a little bit more respectful in here. From your first answer you are a little bit pushy.
Give me a second 

Copy code
open class UiEvent

interface PersonalInfoViewModelContract {

    sealed class Event: UiEvent() {
        data class CheckoutClicked(val s:String = "") : Event() {
            override fun toString() = "PersonalInfoViewModelContractEventCheckoutClicked"
        }
    }
}

val instance = PersonalInfoViewModelContract.Event.CheckoutClicked("foo")
print(instance)
if you want it more dynamic you can also do
Copy code
interface PersonalInfoViewModelContract {

    sealed class Event: UiEvent() {
        override fun toString(): String {
            return javaClass.name.replace("$", "")
        }
        data class CheckoutClicked(val s:String = "") : Event() {
            override fun toString() = super.toString()
        }
    }
}
đŸ‘đŸ»
Wow, and this is a great move @huthefa in deleting your messages 😅 đŸ‘đŸ»