I have the following code:
Html.fromHtml(getString(R.string.privacy_policy_text)
however, Html.fromHtml()
is deprecated. I know I am supposed to use HtmlCompat
as indicated here. However, I don't know what I have to include in my build.gradle file for that class to be available even after a lot of Googling.
I already have the following support libraries in my build.gradle:
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:recyclerview-v7:27.1.1'
In the current edition of the Android JavaDocs, there are notes about which artifact supplies a particular class.
Here, we see "belongs to Maven artifact androidx.core:core:1.0.0-beta1`. That tells you a specific artifact and version to use, though the version you may need to synchronize with other artifacts that you are using.
This is an androidx
artifact, as a part of the grand refactoring of the Support Library. This may cause problems with your project, which is using the classic Support Library artifacts. You may wish to hold off on using HtmlCompat
until you can switch your whole project over to androidx
artifacts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With