Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9275071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:30:10+00:00 2026-06-18T16:30:10+00:00

I am fairly good in fragments API, I know how to create master/detail pattern

  • 0

I am fairly good in fragments API, I know how to create master/detail pattern on phone/tablet.
But how would I create a different style of navigation in phones and tablets?

The most obvious example would be swiping tabs on the phone and somekind tablet layout with all the fragments layed out inside, no swiping tabs.

Is there some elegant way of doing this other than giant if statement?

enter image description here

//EDIT

So what would you do, as I presumed, is to create create two layouts (phone – view pager / tablet – three static fragments) and in activity’s onCreate check for something in the layout to figure out wether youre in phone or tablet. Then just initialize the tabs navigation / or not if youre in tablet. That should work.

CODE SNIPPETS FROM IO 2012 APP

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_home);
    FragmentManager fm = getSupportFragmentManager();

    mViewPager = (ViewPager) findViewById(R.id.pager);
    if (mViewPager != null) {
        // Phone setup
        mViewPager.setAdapter(new HomePagerAdapter(getSupportFragmentManager()));
        mViewPager.setOnPageChangeListener(this);

        final ActionBar actionBar = getSupportActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        actionBar.addTab(actionBar.newTab()
                .setText(R.string.title_my_schedule)
                .setTabListener(this));
        actionBar.addTab(actionBar.newTab()
                .setText(R.string.title_explore)
                .setTabListener(this));
        actionBar.addTab(actionBar.newTab()
                .setText(R.string.title_stream)
                .setTabListener(this));

        homeScreenLabel = getString(R.string.title_my_schedule);

    } else {
        //Tablet setup
        mExploreFragment = (ExploreFragment) fm.findFragmentById(R.id.fragment_tracks);
        mMyScheduleFragment = (MyScheduleFragment) fm.findFragmentById(R.id.fragment_my_schedule);
        mSocialStreamFragment = (SocialStreamFragment) fm.findFragmentById(R.id.fragment_stream);
    }
}

Any of you guys that already have tabs navigation on phone, please consider implementing this on the tablet, if it works for you design-wise. You already have fragments api ready, so there’s no excuse, really.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T16:30:12+00:00Added an answer on June 18, 2026 at 4:30 pm

    You could take a look at the 2012 I/O app from Roman Nurik, which switches navigation/layout pretty much with every possible combination of size and orientation;

    http://code.google.com/p/iosched/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The title is fairly self-explanatory, but I'll reiterate: What would be a good variable
I searched and found three fairly good posts but all of them were animating
I have a fairly good understanding of individual OSS licenses, but I always have
I am fairly new to Android programming, but I am getting pretty good at
Im alright with java and have a fairly good understanding also but im stuck
Using vim + php + ctags I can get fairly good php auto-completion. But
I'm fairly new to clojure but I've been having trouble finding good resources and
This is a fairly basic question, but haven't seen a good answer on various
I am fairly new to Java so am looking for a good way of
I am fairly new to C. (I have good knowledge of C# [Visual Studio]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.