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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:11:42+00:00 2026-05-23T22:11:42+00:00

I have two xml file. I want this two xml file in the same

  • 0

I have two xml file. I want this two xml file in the same activity but when I try to use it I am getting error.

code for 1.xml

<LinearLayout
       xmlns:android="http://schemas.android.com/apk/res/android"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       android:orientation="vertical"
       android:layout_gravity="center_vertical|center_horizontal"
       android:background="@drawable/back_image">
      <ImageView android:src="@drawable/loading_logo"
         android:id="@+id/ImageView01"
         android:layout_gravity="center_vertical|center_horizontal"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginTop="120dip">
      </ImageView>
      <TextView 
        android:id="@+id/textView1" 
        android:text="www.seecycle.com"
        android:layout_marginTop="100dip"
        android:gravity="center_horizontal|center_vertical"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:layout_below="@+id/ImageView01"
        android:textColor="#FFFFFF"
        android:textSize="20dip">
      </TextView>

</LinearLayout>

code for 2.xml

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:orientation="vertical"    
            android:layout_width="fill_parent"    
            android:layout_height="fill_parent"
            android:id="@+id/layout_root">
              <TextView android:id="@+id/text"
              android:gravity="center_vertical|center_horizontal"
              android:layout_marginTop="10dip"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:textColor="#FFFFFF"
              />
              <TextView android:id="@+id/text1"
              android:layout_marginTop="10dip"
              android:gravity="center_vertical|center_horizontal"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:layout_below="@+id/text"
              android:textColor="#FFFFFF"
              />
              <TextView android:id="@+id/text2"
              android:layout_marginTop="10dip"
              android:gravity="center_vertical|center_horizontal"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:layout_below="@+id/text1"
              android:textColor="#FFFFFF"
              />
              <EditText android:id="@+id/text3"
              android:layout_width="fill_parent"
              android:layout_marginTop="20dip"
              android:layout_height="fill_parent"
              android:layout_below="@+id/text1"
              android:textColor="#000000"


              />
</LinearLayout>

code for .java file

public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
setContentView(R.layout.1);
setContentView(R.layout.2);//when i use this it generate an error
}
  • 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-05-23T22:11:42+00:00Added an answer on May 23, 2026 at 10:11 pm

    setContentView is not meant to be called multiple times. As the name suggests, it “sets” the view, not add it to an existing set of views.

    You need to include the 2nd layout xml in the first, using <include layout="@layout/name-of-layout">

    Update:

    Change 1.xml to

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:layout_gravity="center_vertical|center_horizontal"
        android:background="@drawable/back_image">
        <ImageView android:src="@drawable/loading_logo"
            android:id="@+id/ImageView01"
            android:layout_gravity="center_vertical|center_horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="120dip">
        </ImageView>
        <TextView 
            android:id="@+id/textView1" 
            android:text="www.seecycle.com"
            android:layout_marginTop="100dip"
            android:gravity="center_horizontal|center_vertical"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:layout_below="@+id/ImageView01"
            android:textColor="#FFFFFF"
            android:textSize="20dip">
        </TextView>
        <include layout="@layout/2" />
    </LinearLayout>
    

    In the activity, only do

    setContentView(R.layout.1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In this the catalog.xml file. I have two books who have the same inventory
I want to parse a large XML file and I have two options: Perl
I have an xml file like this: <root> <item> <name>one</name> <status>good</status> </item> <item> <name>two</name>
hi i have two xml file and i want to bind grid view eith
Suppose I have two XML files. First XML File: <?xml version=1.0?> <AccessRequest xml:lang=en-US> <AccessLicenseNumber>Your_License</AccessLicenseNumber>
I have two XML files. They are similar, but there are two nodes of
this is my situation: I have two org.w3c.dom.Document created from two xml files. What
My application requires 2 screens and for this I have created two different XML
I have an xml file right now which has a TableLayout within a LinearLayout.
How can I do a Linq query for this? I have two xml documents,

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.