I am trying to make a gallery slider application in which i have a grid of all the images when an image is clicked the URLs list is passed to another activity with clicked position.URLs list is converted as fragments list.I want to have shared element transition from my source activity to the fragment fixed in the ViewPager Based on postion
This is my onClick listener in source activity
Bundle bundle = new Bundle();
bundle.putSerializable("list", imagePaths);
bundle.putInt("pos", adapterPosition);
Intent intent = new Intent(context, SliderActivity.class);
intent.putExtras(bundle);
ActivityOptionsCompat options = ActivityOptionsCompat.
makeSceneTransitionAnimation((Activity) context,view,name);
context.startActivity(intent,options.toBundle());
This is my receiver code in destination activity.
mList = (ArrayList<Object>) getIntent().getSerializableExtra("list");
for (Object obj : mList) {
SliderFragment frag = SliderFragment.newInstance(type, obj);
mFragmentList.add(frag);
}
mAdapter = new MyPagerAdapter(getSupportFragmentManager(),mFragmentList);
mViewPager.setAdapter(mAdapter);
mViewPager.setCurrentItem(getIntent().getIntExtra("pos"), true);`