Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoSuchMethodError: android.view.Window.getSharedElementEnterTransition

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());
    }
like image 665
gaurav24 Avatar asked Jul 28 '26 23:07

gaurav24


1 Answers

It works fine with API 21 and above . API 19 do not recognize it.

like image 185
Android Avatar answered Aug 01 '26 03:08

Android



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!