public void refresh() {
    // View for displaying SnackBar
    View llSnackBar = findViewById(R.id.drawer_layout);
    if (Connectivity.isNetworkAvailable(MainActivity.this)) {
      new RefreshRequest().execute();

    } else {
      UIUtils.showSnackBar(llSnackBar, getResources().getString(R.string.error_connection));
    }
  }
  @TargetApi(Build.VERSION_CODES.LOLLIPOP)
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    userState = UserProfile.getUserState(this);
    redirectUser(userState);

    setContentView(R.layout.ac_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    final ActionBar ab = getSupportActionBar();
    //        ab.setHomeAsUpIndicator(R.drawable.ic_menu);
    //        ab.setDisplayHomeAsUpEnabled(true);

    //        mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);

    /* swipeContainer = (SwipeRefreshLayout) findViewById(R.id.swipeContainer);
    swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            // Your code to refresh the list here.
            // Make sure you call swipeContainer.setRefreshing(false)
            // once the network request has completed successfully.
            //fetchTimelineAsync(0);
        }
    });*/

    //        NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    //        if (navigationView != null) {
    //            setupDrawerContent(navigationView);
    //        }

    ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
    if (viewPager != null) {
      setupViewPager(viewPager);
    }

    //        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    //        fab.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#3F51B5")));
    //        fab.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View view) {
    //                Snackbar.make(view, "Here's a Snackbar", Snackbar.LENGTH_LONG)
    //                        .setAction("Action", null).show();
    //            }
    //        });

    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
    tabLayout.setupWithViewPager(viewPager);

    if (checkPlayServices()) {
      // Start IntentService to register this application with GCM.
      Intent intent = new Intent(this, IE_RegistrationIntentService.class);
      startService(intent);
    }

    if (Connectivity.isNetworkAvailable(MainActivity.this)) {
      new RefreshRequest().execute();
    }
  }