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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:39:50+00:00 2026-06-08T07:39:50+00:00

How to inflate particular View from separate xml file. Is it possible? When I`m

  • 0

How to inflate particular View from separate xml file. Is it possible? When I`m trying to set id of this View I just have an ResourceNotFoundException.
Maybe I need to set somehow the name of file?

LayoutInflater inflater = LayoutInflater.from(this);
FrameLayout ingredients_frame = (FrameLayout)inflater.inflate(R.id.ingredients_frame, null);

R.id.ingredients_frame located just in separate xml file.

Exception:

 android.content.res.Resources$NotFoundException: Resource ID #0x7f060032 type #0x12 is not valid

ingredients_frame_layout.xml:

<FrameLayout 
           xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/ingredients_frame"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/expandable_second_layer_selector" >

            <TextView
                android:id="@+id/text"
                android:layout_width="fill_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:background="@android:color/white"
                android:singleLine="true"
                android:text="......................................................................................................................................................................"
                android:textColor="@color/dark_orange"
                android:textSize="18dip"/>

            <TextView
                android:id="@+id/ingredient_name"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_gravity="left"
                android:background="@android:color/white"
                android:textStyle="bold"
                android:text="@string/friends_total"
                android:textColor="@color/dark_orange"
                android:textSize="18dip" />

            <TextView
                android:id="@+id/ingredient_data"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_gravity="right"
                android:background="@android:color/white"
                android:textStyle="bold"
                android:textColor="@color/dark_orange"
                android:textSize="18dip" />
    </FrameLayout>          
  • 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-08T07:39:51+00:00Added an answer on June 8, 2026 at 7:39 am

    Try like this –

    LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View vi = inflater.inflate(R.layout.ingredients_frame_layout, null);
    

    And, the use of View class object you can identifiy other components which is in your layout. Ex, if you’ve one textView in your layout example

    TextView tv = (TextView)vi.findViewById(R.id.textView1);
    tv.setText("Hello world");
    

    Based on this, just identify your FrameLayout like this

    FrameLayout ingredients_frame = (FrameLayout)vi.findViewById(R.id.ingredients_frame);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a layout that is a separate file, so I inflate it.
How could i inflate my custom view using the main.xml file? I thought it
I have this: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout layout = (LinearLayout) View.inflate(this,
So I'm just trying to currently inflate a view in my getView function and
I know in my onCreate() I can inflate a view from XML by something
Is possible to generate/inflate a view declared within a layout? For example: I have
I inflate my context menu for listview from xml like this: public void onCreateContextMenu(ContextMenu
i get an Inflate Exception, android.view.InflateException: Binary XML file line #76: Error inflating class
I have multiple instances of a fragment that are inflated from an xml file,
this is dankogai's javascript deflate http://github.com/dankogai/js-deflate I can't inflate from c#,please help me

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.