What is the best way to support legacy methods that are being replaced by new ones?

I like to use the findAll / findAllAsync method in android.webkit.WebView. findAll is deprecated, and Google suggests using findAllAsync, which requires a Jelly Bean or higher. However, I like my app for 2.2+ support. I tried to do the following, but I got a warning for findAll (deprecation) and an error for findAllAysnc (you need to increase the minimum version of the SDK):

      if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
          myWebView.findAll(query);         
      else
      {
          myWebView.findAllAsync(query);
      }

What is the best way to handle this? Should I just use findAll and ignore the failure warning?

+4
source share
3 answers

findAll, , @SuppressWarning("deprecation"), .

, , , , .

0

, :

SDK SDK ?

, Eclipse ( IDE, ) API Android?

( , : " -", " ".)

0

, , . Oracle Java:

, , Java. , , .

, , , ... !

, Android 2.1, Audio Focus , . , , . .

0

Source: https://habr.com/ru/post/1529006/


All Articles