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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:07:31+00:00 2026-06-03T19:07:31+00:00

Some background: I am having an issue with one part of my program where

  • 0

Some background:
I am having an issue with one part of my program where I am building a ‘edit database’ view and then removing the rows again. The fields which the ‘edit database’ view will show are different each time it is shown. The edit database view is a tablelayout, and each row in the database is a row in the table layout. when the user exits the edit view, the view is supposed to be disposed or wiped of rows for the next time.

My issue, is no matter what I try, I can’t get the rows in the tablelayout to delete. Here are the relevent pieces of code:

Get a handle on the tablelayout in the xml file

setContentView(R.layout.database_entry);
TableLayout editorLayout = (TableLayout)findViewById(R.id.DatabaseLayout);

the layout is passed to another class, where they are added to the layout like this:

//layout is the tablelayout from earler, passed into this function
TableRow row = new TableRow(contex);
row .setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
//stuff added to the row....
//...
//...
layout.addView(row);

When I attempt to wipe the Tablelayout, I run this code

TableLayout editorLayout = (TableLayout)findViewById(R.id.DatabaseLayout);
editorLayout.removeAllViews();

Whatever I do, the next time I hit the button to edit the code, it will show the previous rows, as well as the new rows added. They are not removed from the table. I get no error messages or any useful debugging information, it just isn’t functioning.

I have struggled with this for a while. Tried dynamically creating the tablelayout(no xml file), tried deleting each row (or just ONE row) with it’s index. I have used the Hierarchy Viewer to check to make sure everything is a child of that tablelayout (it is). If anyone has any insight, it would be much appreciated.

  • 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-03T19:07:35+00:00Added an answer on June 3, 2026 at 7:07 pm

    I was able to figure out the issue. First of all, the comment above was a little bit wrong, the mChildren array did not contain any pointers to the views I had deleted. They were nulled out, just as they should have been.

    The reason why none of my rows were deleted is because right after I called removeAllViews() I switched content views setContentView(R.layout.main);. when I commented this line out, the remove children code worked as expected. I assume some android back-end optimization code decided that the removeAllViews() didn’t need to be run, or updated somewhere in memory. And all the changes made while inside this function didn’t apply.

    I will be putting all of this code in a new activity (where it really belonged in the beginning). But I wanted to provide an explanation in case someone else is having the same issue.

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

Sidebar

Related Questions

I'm having a really weird issue with a background worker in one of my
I'm having a really odd issue and maybe one of you can shed some
The background: I'm having some problems with Thoughtbot's Factory Girl gem, with is used
Some background: I've created a Swing application which uses the Substance LaF (Thanks again,
Some background: I'm a jack-of-all trades, one of which is programming. I learned VB6
Having issues displaying some websites within iframes. Live example of code This one works.
I having an issue where the ImageButton background is being drawn with a different
I'm having some troubles with displaying a graph. It's a very strange issue, because
I am having issues of having an image change dynamically. Some background info: I
Background I'm having trouble understanding the primary key choices in the database for 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.