I am working on android shared element transition. I tried the code below only second activity opens with a blink. I have passed same transition name in both imageview but still not working.
imageview.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
View imageView = findViewById(R.id.imageView);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Intent intent = new Intent(StartActivity.this, EndActivity.class);
Pair<View, String> pair1 = Pair.create(imageView, imageView.getTransitionName());
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(StartActivity.this, pair1);
startActivity(intent, options.toBundle());
} else {
Intent intent = new Intent(StartActivity.this, EndActivity.class);
startActivity(intent);
}
}
});