try { Class cls = Build.VERSION.class; Field sdkField=cls.getDeclaredField("SDK_INT"); }catch (SecurityException se) { // TODO: handle exception }catch (NoSuchFieldException ne) { // TODO: handle exception mIsAntiShaking=false; } // catch (ClassNotFoundException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // }