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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:23:29+00:00 2026-05-31T09:23:29+00:00

In my app, i am loading a layout dynamically with text views ,on a

  • 0

In my app, i am loading a layout dynamically with text views ,on a button’s onclick event. when i click the button for the first time , i got my layout with text views. when i click it again ,it should display the layout again. but its showing error. my code is

    private OnClickListener some_name = new OnClickListener(){
        public void onClick(View v) {
LinearLayout my_list_layout = (LinearLayout)findViewById(R.id.my_list_layout);
        my_list_layout.setOrientation(1);
        my_list_layout.setId(50);
        my_textview = new TextView[length];

        for(int i=0; i<length ; i++)
            {
                my_textview[i]= new TextView(getApplicationContext());
                my_textview[i].setText("sample text");
                my_textview[i].setId(i);

                if(i==0)
                    {
                        RelativeLayout.LayoutParams my_textviewparams = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);
                        my_textviewparams.addRule(RelativeLayout.ALIGN_PARENT_TOP,my_list_layout.getId());
                        my_list_layout.addView(my_textview[i],my_textviewparams);
                    }
                else
                    {
                        RelativeLayout.LayoutParams my_textviewparams = new RelativeLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);
                        my_textviewparams.addRule(RelativeLayout.BELOW,my_textview[i-1].getId());
                        my_list_layout.addView(my_textview[i],my_textviewparams);
                    }
    }
    }

and my error log is

enter image description here

quick response is needed. anyone tell me, what is my wrong in coding, or what changes i have to do for my requirement?

  • 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-31T09:23:31+00:00Added an answer on May 31, 2026 at 9:23 am

    I got the answer.Here while i was doing first time the btn click, the child view will added to my parent view dynamically.

    During the second click the i removed previously added child from my parent view and added the new child. So this will updates my content and displays clearly every time when I click the btn.

    I got error in removing the views from my child, now I clear the error by assigning some variables for identifying btn click, whether user clicks it for first time or not. thank you all for your time here and for your answers.

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

Sidebar

Related Questions

I've got a WebBrowser control on a WinForms app that is loading XML which
I'm trying to optimize the startup time/class loading time of my Java web app
I am currently loading text into my app from an xml file from server.
I've got an app, that has 2 activity, the first one launch the second
I am loading an image from an URL on button click, and storing it
I've got an app that has a handheld layout.xml and a tablet layout.xml. Inside
im using for first time appcelerator for a Iphone app, im using a TableViewRow,
How can I delay the app loading to show the splash screen for longer?
I'm trying to display a loading icon while my iPhone app downloads a network
How do I keep a Monotouch iPhone app in landscape mode when loading a

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.