I am beginning to learn Android programming. When you declare objects of type EditText and initialize them later, why do you cast findViewById's contents to EditText?
What does findViewById return that needs to be casted?
As daniel_c05 pointed out, findViewById return type is View (which is the parent class for EditText and other classes for visual widgets).
In Java, you need to cast to a specific type in this case - that's the requirement of the language.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With