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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:56:19+00:00 2026-06-18T05:56:19+00:00

I am implementing fragments for the first time so please help me. <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android

  • 0

I am implementing fragments for the first time so please help me.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <fragment android:name="com.example.news.ArticleListFragment"
            android:id="@+id/list"
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="match_parent" />
    <fragment android:name="com.example.news.ArticleReaderFragment"
            android:id="@+id/viewer"
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="match_parent" />
</LinearLayout>

I want that fragment having the id as ‘list’ should remain constant but the the fragment having id ‘viewer’ should be able to call different classes.

(Note that the classes extend Activity.)

My question is simple: I have four classes(Extending ACTIVITY). I want to divide the screen into two parts. The left Side remains constant which contains the listview. On list view’s click I want to open my Class(Extending ACTIVITY), but only in the right portion(remaining screen).

  • 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-18T05:56:21+00:00Added an answer on June 18, 2026 at 5:56 am

    According to the android documentation of fragments:
    A Fragment represents a behavior or a portion of user interface in an Activity. You can combine multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple activities. You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own input events, and which you can add or remove while the activity is running (sort of like a “sub activity” that you can reuse in different activities).

    http://developer.android.com/guide/components/fragments.html

    what i understood from your question is that you want to the content of your fragement viewer at run-time. a possible solution which i can suggest for this is:
    Instead of your four classes extending Activity, extend Fragment, each having its own layout. Modify the main layout file to look something like this:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <fragment android:name="com.example.news.ArticleListFragment"
            android:id="@+id/list"
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="match_parent" />
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/viewer"
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="match_parent" >
    </FrameLayout>
    
    </LinearLayout> 
    

    the FrameLayout will basically act as a container for your fragments, which you can dynamically load at run-time(by clicking the ListView). This tutorial will help you out with it:

    http://developer.android.com/training/basics/fragments/fragment-ui.html

    Hope my answer helps you in some way.

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

Sidebar

Related Questions

I'm having all sorts of problems implementing styles in action bar, i've read http://android-developers.blogspot.com/2011/04/customizing-action-bar.html
I'm implementing some code from an example (http://arvid-g.de/12/android-4-actionbar-with-tabs-example) and trying to convert it to
Trying to follow the examples given in http://developer.android.com/guide/topics/ui/settings.html but finding it difficult as it
I'm implementing a fragment hierarchy similar to the one described in Fragments (Android Developers)
I'm implementing fragments in my app. In order to keep the compatibly with Android
I have been using this link to implement my two screen tabbed view, http://developer.android.com/training/implementing-navigation/lateral.html
I tried this: http://channel9.msdn.com/posts/RobBagby/deCast-Entity-Framework-Modeling-Implementing-Entity-Splitting/Default.aspx?wa=wsignin1.0 ...with the Northwind sample database from Codeplex, using the Employee
Happy New Year All, New with implementing Fragments in Android (and I have seen
Whilst implementing my first MVVM application in WPF, I've been wondering about the pros
I am implementing nested fragments in my app using the new API 17, which

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.