How to use txtV1.setBackground(getResources().getDrawable(R.drawable.bcgrtxt));`in Older Devices?

StackOverflow https://stackoverflow.com/questions/22743236

  •  24-06-2023
  •  | 
  •  

Question

How to use

txtV1.setBackground(getResources().getDrawable(R.drawable.bcgrtxt));

in Older Devices ?

Was it helpful?

Solution 2

.setBackground was added in API Level 16

and .setBackgroundResource was added in API Level 1

so you can use .setBackgroundResource instead of .setBackground

OTHER TIPS

View.setBackground replaced View.setBackgroundDrawable as of API level 16.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top