I am working on transitions for Android API level 19 and above. I have added support libraries as well to the project and have used both the getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS) & getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS) flags. But still I am getting java.lang.NoSuchMethodError for the method getSharedElementEnterTransition(). Can anyone tell me the solution to include transitions method for API level 19??
Here's the code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
setContentView(R.layout.prescription);
mPresLayout=(RelativeLayout)findViewById(R.id.pres_layout);
mPres_text=(TextView)findViewById(R.id.pres_text);
ViewCompat.setTransitionName(mPresLayout, PRESLAYOUT_NAME);
ViewCompat.setTransitionName(mPres_text, PRESLAYOUT_TEXT);
addTransitionListener();
getWindow().setAllowEnterTransitionOverlap(false);
getWindow().setAllowReturnTransitionOverlap(false);
getWindow().setSharedElementExitTransition(null);
getWindow().setSharedElementReenterTransition(reenterTransition());
}
It works fine with API 21 and above . API 19 do not recognize it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With