@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my);

    pull_to_dismiss_pager = (PullToDismissPager) findViewById(R.id.pull_to_dismiss_pager);
    pagerAdapter = new SlidingPagerAdapter(this);
    pull_to_dismiss_pager.setPagerAdapter(pagerAdapter);
  }
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   // Handle action bar item clicks here. The action bar will
   // automatically handle clicks on the Home/Up button, so long
   // as you specify a parent activity in AndroidManifest.xml.
   int id = item.getItemId();
   if (id == R.id.action_show) {
     pull_to_dismiss_pager.expandPanel();
     return true;
   }
   return super.onOptionsItemSelected(item);
 }
 @Override
 public void onBackPressed() {
   if (pull_to_dismiss_pager.isPanelExpanded()) pull_to_dismiss_pager.collapsePanel();
   else super.onBackPressed();
 }