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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:34:13+00:00 2026-05-27T18:34:13+00:00

Could somebody help me? For example, there is the following layout: main.xml: <LinearLayout android:id=@+id/linearLayout_item

  • 0

Could somebody help me?

For example, there is the following layout:

main.xml:

<LinearLayout
    android:id="@+id/linearLayout_item"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/linearLayout_item_name"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <EditText
                android:id="@+id/editText_item_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

        ... Other views, skipped ...

    </LinearLayout>
    <Button
        android:id="@+id/button_add_alias"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <Button
        android:id="@+id/button_commit" 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

</LinearLayout>

I use button_add_alias to add views as they needed.

((Button) findViewById(R.id.button_add_alias))
        .setOnClickListener(new View.OnClickListener() {
            int position = 1;
            public void onClick (View v) {
                View view = getLayoutInflater().inflate(R.layout.alias, null);
                ((LinearLayout) findViewById(R.id.linearLayout_item)).addView(view, position);
                position++;
            }
    });

alias.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linearLayout_alias"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <EditText
        android:id="@+id/editText_alias"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

    ... Other views, skipped ...

</LinearLayout>

So, what is the best way to get data from programmatically added editText_alias views?

  • 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-27T18:34:14+00:00Added an answer on May 27, 2026 at 6:34 pm

    Firstly, iterate through your LinearLayout using getChildAt().
    Then, retrieve the first child (which in your case will be the EditText) from your child view.

    LinearLayout parent = (LinearLayout) findViewById(R.id.linearLayout_item);
    
    for (int i = 0; i != parent.getChildCount(); i++) {
       if (parent.getChildAt(i).getId() == R.id.linearLayout_alias) {
           LinearLayout alias = (LinearLayout) parent.getChildAt(i);
           EditText editAlias = (EditText) alias.getChildAt(0);
    
           // do what you want with the EditText
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

could somebody help me and give a example of how can I do a
Could somebody please help me get Clang up and running? (I don't have 3.2)
I've run into a little hurdle and wanted to see if somebody could help
I'm a newb when it comes to javascript. Perhaps somebody could help me with
Could somebody point me to an example how to search for phrases with Lucene.net?
Could somebody please take some time to show me a quick example on how
Maybe somebody could help me. I need a two methods. The first should open
I am very new to the whole J2EE architecture. Could somebody help me out?
Could somebody get me started with the following idea: I want to load an
I would like inherit a 'submethod' of a method in python. Could somebody help

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.