Android App Development Tutorial 23 - Casting a View in an Expression (Not a statement fix) | Java

preview_player
Показать описание


~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~

🅑 Bitcoin - 3HnF1SWTzo1dCU7RwFLhgk7SYiVfV37Pbq
🅔 Eth - 0x350139af84b60d075a3a0379716040b63f6D3853
Рекомендации по теме
Комментарии
Автор

Absolutely useful . I am used to Kotlin, but now I have to hack an app which was written completely in java. This helps a lot. Thank you!

akiyai
Автор

you don't have to create a View object for it and then cast, since you'r doing a down casting, it means that Button Class inherits from the View class, so the Button class has the same methods of the View class. Therefore, you can initialize Button btn = findViewById(R.id.button); then do the same process without dealing with the casting

tonyhabib
Автор

((Button) view).setText("DrCod3r"); // Simple as this

drcodr
Автор

This is basic java and not specific to Android app development.

MrJgremmen
visit shbcf.ru