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 9196817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:56:01+00:00 2026-06-17T21:56:01+00:00

I have encountered a problem which i’m unable to solve, I googled a lot

  • 0

I have encountered a problem which i’m unable to solve, I googled a lot but couldn’t find a solution.

In my app I have a ViewPager which contains 3 pages. These pages are fragments as they should be. This works alright. However two of these pages must be Master/Detail flows (one for friends list, one for news feed). When I create a master/detail flow with eclipse 2 fragments and 2 activities are created. The ItemListActivity (the one that needs to be shown) implements the fragment’s Callbacks, and this is an Activity, but ViewPager only accepts Fragments inside itself.

So the question is: How can I place Master/Detail Flow inside a ViewPager?

All help is much appreciated!
I’m all out of ideas here.

Thanks

  • 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-17T21:56:02+00:00Added an answer on June 17, 2026 at 9:56 pm

    Master/Detail Flow is just a nickname for 2 fragments being used in the same content view, one on the left and one on the right. That’s the general idea. Now, the Master/Detail Flow can be used inside an Activity (like Eclipse does for the template you described) or inside a Fragment, fortunately since Android 4.2 introduced Fragments inside other Fragments (this is also supported by the Android Compatibility Library for older version of Android).

    The template generated by Eclipse is contained in an Activity (on tablets), or 2 Activities (for phones), because Eclipse doesn’t know you need master/detail inside a fragment. So, you can’t rely on Eclipse’s template. But it’s not that hard to just put 2 Fragments inside another Fragment.

    You just need to forget about the ViewPager for a while and do your work inside the Fragment that will contain the Master/Detail Flow, let’s call it MasterFragment.

    1. Declare 2 more Fragments: InnerListFragment, InnerDetailFragment. Also a InnerDetailActivity for phones.
    2. Declare 2 XML layout files for MasterFragment:

      • layout/fragment_master.xml – add inside this only the InnerListFragment <fragment> tag
      • layout-sw600dp/fragment_master.xml (for tablets >7″) – add both InnerListFragment and InnerDetailFragment <fragment> tags.
    3. Now, I won’t detail all your java code here, but inside MasterFragment.java, you need to check if the device is a tablet so that you know which of the 2 fragments are active on the screen.

      • if it’s a phone, only InnerListFragment is visible. So just add the list and onClickListener will start InnerDetailActivity in which you need to put InnerDetailFragment.

      • if it’s a tablet, both Inner fragments are visible. Don’t start a new activity when clicking on a list item, just have a reference to both fragments inside MasterFragment so you can communicate between them.

    That’s the general idea. If you still have questions, do ask.

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

Sidebar

Related Questions

I have encountered a problem on my website, which I am unable to solve.
I have encountered a problem i cannot find a solution. I am using a
I have encountered a problem which I can't solve. I have to draw a
I have encountered a problem in one of my Java projects, which causes bugs.
I'm currently exploring powershell capabilities, but I have encountered a problem that I have
I have encountered a problem, for which no matter how long I study the
I have encountered a weird problem and I can't manage a way to solve
Here is a problem I have encountered. I have jsp page which has a
I am encountering a problem which I have never encountered before. I am working
I encountered a problem which I need some help with - suppose I have

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.