0

with the introduction of Android 4.4 has changed the webview, I would understand that if the app is running on Android 4.4 with this type of webview:

WebSettings settings = webView.getSettings (); 
settings.setUseWideViewPort (true); 
settings.setLoadWithOverviewMode (true); 

otherwise it executes the code that I already have that with the webview on Android versions less than 4.4 works great. you can do an if?

DevOkAnd
  • 113
  • 1
  • 2
  • 8

2 Answers2

0
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { 
    // do stuff for older than Kitkat.
}
Simon
  • 14,407
  • 8
  • 46
  • 61
  • I already have a webview that works well for me and less than 4.3, the if I want to do just to kitkat performing this part here http://developer.android.com/guide/webapps/migrating.html – DevOkAnd Mar 09 '14 at 10:55
0

Get the device's OS version with android.os.Build.VERSION.SDK_INT, and the compare it with the kitkat version code. Build.VERSION_CODES

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
    WebSettings settings = webView.getSettings (); 
    settings.setUseWideViewPort (true); 
    settings.setLoadWithOverviewMode (true);

    doMoreKitKatStuff();
}
Joel Brito
  • 339
  • 3
  • 9