Skip to main content

Posts

Showing posts from July, 2014

Android swipe views example

It is very easy to create an android swipe views using the ViewPager and FragmentPagerAdapter class. In this example i create three fragments and i make the fragments visible in an android swipe view in the MainActivity xml layout file. Here are the steps i follow for creating this example. Step 1: Add the ViewPager element to the activity_main.xml file. Step 2: Extends the MainActivity.java class with FragmentActivity. Step 3 : Create an adapter class that extends the FragmentPagerAdapter class Step 4: Create three Fragments and its layouts. Step 5: Create an object of the adapter class and set it as the adapter for the ViewPager.              WATCH VIDEO OF THIS TOPIC DOWNLOAD THIS PROJECT MainActivity.java package com.swapdemo; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; public class MainActivity extends FragmentActivity { ViewPager viewpager; @Override protected voi