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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:36:14+00:00 2026-06-05T14:36:14+00:00

I need help, my layouts and containers are lingering on after I have used

  • 0

I need help, my layouts and containers are lingering on after I have used the code bellow to remove them.

For example I have page 1 that adds a small text that explains how to use the part of the program under scrutiny, and then the next page allows the user to add a name where there is a label with text Name: and a EditText to add the name in next to it.

Both the components ‘stick’ but the EditText is reproduced multiple times and I have no idea why! I would also like to stop the sticking.

By sticking I simply mean that the view does not leave view like it should(still visible).

Here is some code.

        if(pageCount == lastPageCount--)
        {
            page2Layout.removeAllViews();
            //page2Layout.setVisibility(View.GONE);
            //Reset all text views.
            helpText.setText("");
        }

        helpText.setLayoutParams(params);
        helpText.setText("You cannot view this part sorry :S\n\n" + 
        "You cannot view this part sorry :S.\n" +
        "You cannot view this part sorry :S");
        page1Layout.addView(helpText);

        page1Layout.setVisibility(View.VISIBLE);
    }
    else if(pageNumber == 2)
    {
        if(pageCount == lastPageCount++)
        {
            //page1Layout.setVisibility(View.GONE);
            page1Layout.removeAllViews();
        }
        else if (pageCount == lastPageCount++)
        {
            page3Layout.setVisibility(View.GONE);
        }
        //Name Position + Containers etc
        LinearLayout nameLayout = new LinearLayout(this);
        nameLayout.setOrientation(LinearLayout.HORIZONTAL);
        nameLayout.setLayoutParams(params);
        TextView nameLabel = new TextView(this);
        nameLabel.setLayoutParams(params);
        nameLabel.setText("Name: ");
        EditText nameTextField = new EditText(this);
        nameTextField.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
        //All to name layout.
        nameLayout.addView(nameLabel);
        nameLayout.addView(nameTextField);
        page2Layout.addView(nameLayout); 
        page2Layout.setVisibility(View.VISIBLE);
    }
  • 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-05T14:36:15+00:00Added an answer on June 5, 2026 at 2:36 pm

    Beware of the stupid mistakes coders can make when they stare at code too long.

        if(pageCount == lastPageCount++)
    

    For anyone who is also stuck similarly, lastPageCount++ will increment lastPageCount after the statement has run.

    Therefore the wrong code is run.

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

Sidebar

Related Questions

Need help with a query that I wrote: I have three tables Company id
I need some help. In my android app I have a ViewFlipper that contains
i need some help in addition to android-layouts. For eyample: Actually I use a
need help/guide for sql select query, I have 2 table stock and stock_history, in
I need to create four different layouts, each one to a page of ViewPagerIndicator.
I have a page layout that needs to reduce from a 3 column layout
I have a problem. I need to know whether my page has global errors
i have a website that uses a number of containers (div's). In this scenario,
i need help on how to make fixed textview size in table layout. say
I'm in need of some basic TSQL help. Here's my table layout: Orders Table

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.