@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_enlarge_photo); // get the intent Intent intent = getIntent(); Bundle data = intent.getExtras(); IntentData intentData = data.getParcelable(Constants.IntentsCodes.intentData); // set the constant views at this activity fillViewWithUserDetails(intentData); // get from the intent the data to pass to the pager adapter String image1Path = intentData.getphoto1Path(); String image2Path = intentData.getphoto2Path(); int votes1 = intentData.getVotes1(); int votes2 = intentData.getVotes2(); boolean isAlreadyVoted = intentData.checkIfVotedAlready(); // EnlargeDetails details = new EnlargeDetails(image1Path, image2Path, // votes1, votes2, isAlreadyVoted); CustomEnlargePagerAdapter adapter = new CustomEnlargePagerAdapter(intentData, getWindowManager().getDefaultDisplay()); ViewPager myPager = (ViewPager) findViewById(R.id.enlargePhoto_viewPager); myPager.setAdapter(adapter); // start the view pager by the current photo int startingImage = intentData.getStartingImage(); myPager.setCurrentItem(startingImage); }