Android Development 23

Android ViewPagerIn this part of my Android Development Tutorial I will cover how to use the Android ViewPager. The ViewPager allows you to flip through Fragments sort of like you would do with a book.

I’ll also cover how to connect the ViewPager with a FragmentManager so that we’ll be able to properly display and track the Fragments and make sure they are updated. If you missed previous parts of this tutorial you should start with part 18. The code follows the video.

If you like videos like this it helps to tell Google+ with a click here [googleplusone]

Code From the Video

ContactViewPager.java

ids.xml

FragmentContactList.java

AndroidManifest

4 thoughts on “Android Development 23”

  1. Hi I have trouble understanding part of the ViewPager adapter code. Can you clarify how ViewPager manages the state of each ContactFragment, when your code returns a new ContactFragment every time getItem() is called? Thanks!

  2. Hi,

    First my Question is why we are not using startActivityForResult() method.

    Secondly when I click on a list item and then change the details and then change the page and then again change the details and go back to the list, the name are all set to empty strings.

    1. Hi,

      I cover startActivityForResult later in the tutorial. I’m basically trying to cover most everything in these tutorials. As they continue I start honing them and making more complete apps.

  3. Hi Derek!!
    You are awesome! I’m speechless staring to your tutorial!! Thank you very much, really.

    I think, my problem is related with the yun zhou’s comment in the tutorial part 22, I can’t understand that problem with the focus, but yun zhou’s comment fixed it for me. Could you explain it?

    Similar to this problem I have other in this part of the tutorial, I introduced this little change:

    public void onPageScrolled(int i, float v, int i2) { Contact theContact = contactList.get(i);
    setTitle(“Mr: ” + theContact.getName());}

    And everything seems to work fine until I scroll to the first person and the tittle become to “Mr 99999999” (the telephone number). Could you help me?

    Thank you a lot, your work is amazing!!!

Leave a Reply

Your email address will not be published. Required fields are marked *