Android View Pager is Layout Manager you can change it Left and Right.And you can see more than one view using swapping.And its works like image galllery.

First insert ViewPager in your xml  layout file ::

 <android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/button1"
android:layout_margin="5dp" />

Now View Pager is working as a horizontal ScrollView.And View Pager have rows for each view.So create row for each view in layout,

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="1dip" >
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:contentDescription="desc" />
<ProgressBar
android:id="@+id/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone" />
</FrameLayout> 

Now at Java Coding side create object of ViewPager and give References from XML file,And ViewPager set  Adapter for pager.

ViewPager pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(new ImagePagerAdapter(imageUrls));

Now extends PagerAdapter Class For  View Pager’s Adapter.Now we have override method which is inflate each row in pager and create view for Pager

@Override
public Object instantiateItem(View view, int position) {
final View imageLayout = inflater.inflate(
R.layout.item_pager_image, null);
final ImageView imageView = (ImageView) imageLayout
.findViewById(R.id.image);
final ProgressBar spinner = (ProgressBar) imageLayout
.findViewById(R.id.loading);
}

instantiateItem Method is working as like as getView method in listView.

Now View Pager has PageChangeListener to listen page changing.You get current page using getCurrentPage from DetailOnPageChangeListener class.

pager.setOnPageChangeListener(new DetailOnPageChangeListener());
public class DetailOnPageChangeListener extends
ViewPager.SimpleOnPageChangeListener {
private int currentPage;
@Override
public void onPageSelected(int position) {
currentPage = position;
}
public int getCurrentPage() {
return currentPage;
}
    }

you get Current page using button click.So when you click on button get current page From Pager Listener. also and you can download below full source code:

Download Android View Pager

Android provides default UI Button for button view.But sometimes we need better UI for application and new colorful button rather than default.so we need to create nice UI for button which looks awesome with application design.

First you add button in your xml layout file.Then create xml in drawable folder for button background.

in xml drawable file add selector for button.

then add item tag for button state.which has different state like state_pressed,state_focused,state_enabled.

So here we used only state_pressed and check its true or false,then we add other property for both state

now  create two <item ></item> tag and put condition state_pressed or not.

After we can set corner radius for button and when we set radius its looks like rounded box.

Now we have <solid> tag for button inner color.so you can set color for both state.

Using <padding> tab you can put inner spacing.and its considering space from corner of button,

And the last tag is <stroke> which is used for rounded colorful border.and you can set thickness of border using width and its have color also for colorful border.

Now just set your button background in xml layout flie.

android:background="@drawable/btn"

So using below code you can create custom and if you want to set other color select your hex string and past in android:color in solid tag.

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"><shape android:shape="rectangle">
 <corners android:radius="10dp" />
<solid android:color="#0c76ab" />
<padding android:bottom="10.0dip" android:left="10.0dip" android:right="10.0dip" android:top="10.0dip" />
<stroke android:width="1.5dip" android:color="#222" />
 </shape></item>
 <item android:state_pressed="false"><shape android:shape="rectangle">
 <corners android:radius="10dp" />
<solid android:color="#d9d9d9" />
<padding android:bottom="10.0dip" android:left="10.0dip" android:right="10.0dip" android:top="10.0dip" />
<stroke android:width="1.5dip" android:color="#222" />
 </shape></item>
</selector>

Download Full Source Code 

1) Create New Facebook App:

https://developers.facebook.com/apps/

2) Add Facebook Id in AndoridManifest file:

if facebook app id is 123456 then put it as below, change it as per your app id.

<application>

 <meta-data
 android:name="com.facebook.sdk.ApplicationId"
 android:value="123456" />
<provider
 android:name="com.facebook.FacebookContentProvider"
 android:authorities="com.facebook.app.FacebookContentProvider123456"
 android:exported="true" />

 </application>

3)  Java Code (Get full code from here: https://goo.gl/ALHTzF)

public class MyActivity extends AppCompatActivity  {
CallbackManager callbackManager;
 Button btnLogin;
@Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.home);
initUI();
 }
private void initUI() {
 callbackManager = CallbackManager.Factory.create();
LoginManager.getInstance().registerCallback(callbackManager,
 new FacebookCallback<LoginResult>() {
 @Override
 public void onSuccess(LoginResult loginResult) {
 Log.d("Success", "Login");
if (loginResult.getAccessToken() != null) {
 String strAccessToken = loginResult.getAccessToken().getToken();
Log.d("Token is", strAccessToken);
 getProfile(loginResult.getAccessToken());
}
 }
@Override
 public void onCancel() {
 showToast("Login Cancel");
 }
@Override
 public void onError(FacebookException exception) {
 showToast(exception.getMessage());
 }
 });
btnLogin = (Button) findViewById(R.id.btnlogin);
 btnLogin.setOnClickListener(new View.OnClickListener() {
 @Override
 public void onClick(View v) {
 LoginManager.getInstance().logInWithReadPermissions(MyActivity.this, Arrays.asList("public_profile", "user_friends"));
 }
 });
 }
public void getProfile(AccessToken accessToken) {
GraphRequest request = GraphRequest.newMeRequest(
 accessToken,
 new GraphRequest.GraphJSONObjectCallback() {
 @Override
 public void onCompleted(
 JSONObject object,
 GraphResponse response) {
//retrive email and name from here...
 Log.d("JSON OBJECT OF PROFILE", object.toString());
 Log.v("GraphResponse : ", response.toString());
}
 });
 Bundle parameters = new Bundle();
 parameters.putString("fields", "id,name,email,gender, birthday");
 request.setParameters(parameters);
 request.executeAsync();
 }
@Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
 super.onActivityResult(requestCode, resultCode, data);
 if (callbackManager.onActivityResult(requestCode, resultCode, data)) {
 return;
 }
 }
 } 

4) You can use it in Fragment too.

btnLogin.setOnClickListener(new View.OnClickListener() {
 @Override
 public void onClick(View v) {
 LoginManager.getInstance().logInWithReadPermissions(MyFragment.this, Arrays.asList("public_profile", "user_friends"));
 }
 });