I get this error for setting the alpha property to a view
java.lang.NoSuchMethodError: android.view.View.setAlpha
in my code
((View) findViewById(R.id.view)).setAlpha(100);
//with float value also doesn't works
What might be the problem ? I do not have any compile errors just on runtime
I used code to setAlpha of the image itself, not the view. This is available from API level 1..
As the documentation states,
setAlpha
requires API 11. You probably have your minSDK set to something below 11 and are installing/running this on a device which is below 11. That means it doesn't have this method, so Java can't find it.probably you have an android:targetSdkVersion higher than 15, so you can validate when use setAlpha or
the value of
Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1
is 15