I want to create a ripple dynamically in code.
Code:
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
buyButton.setBack
The issue is that you need to return a Drawable instead of a RippleDrawable in getPressedColorRippleDrawable
. Otherwise, on pre-lollipop devices, you will get a VerifyError.
That code is indeed not being executed. The app crashes because you're receiving a java.lang.VerifyError
. Try performing a Project → Clean
if you're using Eclipse or Build → Rebuild project
if you're using Android Studio.