android - Airplane mode verification No class Def -


this code generates following error. know why? thanks!

java.lang.noclassdeffounderror: android.provider.settings$global

@suppresslint( "newapi" ) @suppresswarnings("deprecation") public boolean isairplanemodeon(context context) {      if(build.version.sdk_int >= build.version_codes.jelly_bean){         return settings.global.getint(context.getcontentresolver(),            settings.global.airplane_mode_on, 0) != 0; //<--error here     } else {         return settings.system.getint(context.getcontentresolver(),                settings.system.airplane_mode_on, 0) != 0;     }  } 

you should check following:

if(build.version.sdk_int >= build.version_codes.jelly_bean_mr1){ 

because class introduced in api level 17 build.version_codes.jelly_bean_mr1. alternatively do:

if(build.version.sdk_int > build.version_codes.jelly_bean){ 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -