When to use ContextCompat class

后端 未结 3 2010
梦谈多话
梦谈多话 2021-02-07 02:00

I want to know when to use ContextCompact class in an application. Basically what is it used for and when to use it? I have read developers site, it says Cont

3条回答
  •  独厮守ぢ
    2021-02-07 03:01

    basically according to the official developer site it is a Helper for accessing features in Context introduced after API level 4 in a backwards compatible fashion.

    You can look into this link for more details. https://developer.android.com/reference/android/support/v4/content/ContextCompat.html

    Basically getBackgroundResource or getColor method are deprecated and using ContextCompact is an alternative for that. I hope this helps.

提交回复
热议问题