Question: > 
> **public void setTextAppearance (Context context, int resId)
>  Added in API level 1**
>   
> 
>  This method was deprecated in API level 23.
>  Use setTextAppearance(int) instead. 
> 
> 
> 

**My Question**: Why it's been deprecated? Why it doesn't need `Context` anymore? And most importantly, how to use `setTextAppearance(int resId)` for older versions?

Answer: 
You can use `TextViewCompat` from the support/androidX library:

```
    import android.support.v4.widget.TextViewCompat // for support-library
    import androidx.core.widget.TextViewCompat      // for androidX library

    // ...

    TextViewCompat.setTextAppearance(view, resId)

```

Internally it gets the context from the view (`view.getContext()`) on API < 23.

[Source for TextViewCompat](https://android.googlesource.com/platform/frameworks/support/+/refs/heads/master/v4/java/android/support/v4/widget/TextViewCompat.java)

[Source for TextView (API23)](https://github.com/AndroidSDKSources/android-sdk-sources-for-api-level-23/blob/master/android/widget/TextView.java)
The above answer is correct - here's another way too. In Kotlin I wrote an extension which makes life easier if you do support `SDK 23` and below as well as above.

```
   fun TextView.setAppearance(context: Context, res: Int) {
        if (Build.VERSION.SDK_INT < 23) {
            setTextAppearance(context, res)
        } else {
            setTextAppearance(res)
        }
    }

```