Does the Compat pre/suffix has to used everywhere, in xml and code?

if there is for example an

androidx.appcompat.widget.AppCompatButton

in my layout do i then also have to reference it in the code of that type, or can i also just catch it as

Button btn = findViewById(R.id.idOfAboveCompatLayout)

Answer

AppCompatButton extends from Button, so your findViewById() is fine. In general, AppCompatSnicklefritz extends from Snicklefritz (for varying values of Snicklefritz), so you can cast to Snicklefritz without problems.

Leave a Reply

Your email address will not be published. Required fields are marked *