Is "shouldOverrideUrlLoading" really deprecated? If so, what can I use instead?
It seems like shouldOverrideUrlLoading
is deprecated targeting Android N and I need to make an app work since API 19 until the latest right now which is Android N (beta), I use some features that are new in Android N (like Data Saver), so targeting Marshmallow will not help with the issue since I need to use those new features, here is the part of the code I use:
public boolean shouldOverrideUrlLoading(WebView webview, String url) {
if (url.startsWith("http:") || url.startsWith("https:")) {
...
} else if (url.startsWith("sms:")) {
...
}
...
}
And this is the message Android Studio gave me:
Overrides deprecated method in 'android.webkit.WebViewClient'
This inspection reports where deprecated code is used in the specified inspection scope.
Google says nothing about that deprecation.
I wonder if using @SuppressWarnings("deprecation")
will let me work on all devices since the API 19 until the latest Android N Beta (and its final version when it gets released), I can't test it myself, I never used that and I need to be sure that it works, so, anyone can tell?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…