I am developing an application that uses
android.hardware.Camera.parameters.getSupportedPictureSizes ()
This is only available in SDK version 8, and I would like to be compatible with SDK 4, so I did this:
if (Build.VERSION.SDK_INT> = 8) {...}
But on the emulator, he enters that tries to check the link to this function, and he fails:
02-02 11: 20: 10.930: ERROR / dalvikvm (1841): Could not find the android.hardware.Camera $ Parameters.getSupportedPictureSizes method referenced by the com.test.demo.CameraCustom.takeAPicture method
Any idea on how to solve this backward compatibility issue?
I tried using inkocation with this piece of code inside surfaceChanged. Obviously, the code works directly without calling:
try{ windowmanager_defaultdisplay_Rotation = getWindowManager().getDefaultDisplay().getClass().getMethod("getRotation"); Log.v(MainMenu.TAG, "getRotation exist"); }catch(Exception e){ Log.v(MainMenu.TAG, "getRotation dont exist"); } try{ windowmanager_defaultdisplay_Rotation.invoke(null, null); Log.v(MainMenu.TAG, "getRotation invoking ok, rotation "); }catch(Exception e){ Log.v(MainMenu.TAG, "exception invoking getRotation "+e.toString()); }
I get "getRotation exist", but then "exception invoke getRotation java.lang.NullPointerException.
Any idea?
zegnus
source share