142 Android Swipe Tabs Part 3 |

slidenerd · 50K views · 2013 · 11:54

Open on YouTube

Software (other)Web developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users cite it as the tutorial they followed when building ViewPager and ActionBar swipe tabs, then ask about errors that came up in their code.

Recommended by 0 people across 0 different months, 2014 to 2015.

What it is

An 11-minute Android tutorial from the slidenerd channel (part 3 of a swipe tabs series). It adds a ViewPager to MainActivity, sets a FragmentPagerAdapter or FragmentStatePagerAdapter, uses getItem to supply fragments, and uses OnPageChangeListener to keep the ActionBar tabs and the ViewPager in sync.

What people said

Cites samvel1024 · 2014-09 · Stack Overflow · on “Android: Extending and casting Fragment issue”

I am trying to create a ViewPager with several fragments following this tutorial [this video] . The problem is that Eclipse says that there is an error in the following statement: Fragment f = new MyFragment(); But MyFragment extends the class Fragment so it's kind of weird to get errors like this. Here are the codes of MyAdapter and MyFragment classes: package com.example.myapp; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class MyFragment extends Fragment { public View onCreateView(LayoutInflater li , ViewGroup vg , Bundle b) { return li.inflate(R.layout.fragment_layout, vg , false); }

Cites olcayakgn · 2014-11 · Stack Overflow · on “pager Cannot resolved as a variable”

I'm trying to make action bar tabs, but I got a error:"pager Cannot resolved as a variable..." Thansk for your help. Java code; package olcay.akgn.fibonaccicalculator; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.app.ActionBar.Tab; import android.app.ActionBar.TabListener; import android.app.FragmentTransaction; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; im

Cites Swagnik Dutta · 2015-07 · Stack Overflow · on “getActionBar() returns null where Main Activity extends FragmentActivity”

I am trying to learn Swipe tabs in android fragments using 3 tabs by referring to a tutorial. I am getting null pointer exception in the line: actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); since the the following line is returning null actionBar=getActionBar(); Here is the full code. MainActivity.java package com.example.pricababa.learningswipetabs; import android.app.ActionBar; import android.app.FragmentTransaction; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.