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

  • Home
  • SEARCH
  • 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 8276701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:26:57+00:00 2026-06-08T08:26:57+00:00

I have an app where the MainActivity which creates an ActionBar with tabs (used

  • 0

I have an app where the MainActivity which creates an ActionBar with tabs (used ActionBarSherlock for this).

Each tab loads a Fragment. One fragment has a ListView in which I load items. Each item responds to an OnItemClick event.

When an item is clicked then the app gets data from a webserver. I want to show that data in a new ListView. But that’s where i’m stuck.

How can I switch from my first main ListView to a ‘sub-ListView`?

Keep in mind that my current View is a fragment and that it’s loaded inside a tab. I want to remain on the same tab when I show the new ‘sub’ ListView.

Also, when I push the back button on the Android device, then I want it to show the main ListView again.

So actually, kinda like the iPhone does it with their TableView.

  • 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-08T08:26:59+00:00Added an answer on June 8, 2026 at 8:26 am

    You have te use another Fragment in order to do that. You need to create that Fragment and then replace the old one with the FragmentTransaction and if you want to use the “back” button you need to add the new fragment to the Backstack.
    If these ListFragment are quite different in terms of data, I’d have 2 fragment classes (e.g. : FirstListFragment, SecondListFragment).

    Here’s some code from an App I worked on :

        // Here I get the FragmentTransaction
    
        FragmentTransaction ft = getFragmentManager().beginTransaction();
    
        // I replace it with a new Fragment giving it data. Here you need to tell 
        // the FragmentTransaction what (or actually where) and by what you want to replace. 
    
        ft.replace(R.id.fraglist, new ModuleFragment(lpId, sqId, sqName));
    

    The R.id.fraglist should be defined in your XML layout (except if you programmatically created your layout). It’s simply the ID of your default fragment.

        // I set the animation
    
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    
        // I add it to the backstack so I can use the back button
    
        ft.addToBackStack(null);
    
        // Then I finally commit so it happens !
    
        ft.commit();
    

    You can also use a Bundle to parse data like so :

        Bundle moduleBundle = new Bundle();
        moduleBundle.putString("id", id);
        moduleBundle.putString("description", description);
        moduleFragment.setArguments(moduleBundle);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the problem. In my app, I have 5 tabs which contains activities. In
I have a user preference in my app, which gets used by different activities.
I am making an app in which i have a main activity that the
we have app hosted on google app engine for java. In this app we
I have app in which i have recorded sound files i want that i
for example: I have app A, which references library A and library B. in
I have developed some reusable android component which is basically a class . This
I have 2 activities, the first one is the startup one which in it's
I have had this issue for sometime on my app and it always bothered
Myself designing an app which uses GPS and Maps. I have created the UI

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.