0

I came upon this solution to use a Listfragment within a Tab of the Actionbar

  1. I face the same problem as described there, but somehow this solution doesn't work for me.
  2. I want to write an application for android versions greater than 4.0.
  3. I took the Android Sample code for generating Swipe View with tabs, if you generate a new Project and select: Fixed Tabs+Swipe

one Fragment should be a ListFragment, so I came upon this solution but the problem is the MainActivity uses the: import android.support.v4 support. Here is a part of my SectionsPagerAdapter the rest of the code is equal to the prelinked thread.

@Override
    public Fragment getItem(int position) {
        // getItem is called to instantiate the fragment for the given page.
        // Return a DummySectionFragment (defined as a static inner class
        // below) with the page number as its lone argument.
        Fragment fragment = null;
        switch (position) {
        case 0:
            fragment = new ControlFragment();
        case 1:
            fragment = (Fragment)new WrapperListFragment();

        }

        return fragment;
    }

I guess the code here useses the newer packages, so how to combine these two. In general i want to use the actionbar with swipe feature, and one fragment should display a listView.

Thanks in advance.

Community
  • 1
  • 1
dan kutz
  • 107
  • 1
  • 12
  • if your app is just useable for 4.0+ you do not need to use the support-library for your Fragments as it just provides compatibility for <3.0 devices. – bofredo Aug 15 '13 at 12:57
  • Not clear what you are actually asking about. Are you simply trying to have a `ListFragment` in a `ViewPager`? If so, go back and read the docs. There is nothing difficult or confusing about it. – Paul Burke Aug 15 '13 at 13:05
  • @ bofredo, yes you're right i don't need the support lib but i didn't find any examples that show the use of the actionbar with tabs and swipe for android 4.0+ if you know anything regarding that i would appreciate very much. – dan kutz Aug 15 '13 at 13:08

0 Answers0