Android: How to refresh a tablelayout after removing a row?

It gives you better control when using an MVC model where there's a dataset tied to a View . So you could have a class that extends BaseAdapter . This class binds your data to the View and this class also has a method: notifyDataSetChanged() which is what should solve your problem.

Up vote 1 down vote favorite share g+ share fb share tw.

I have a tablelayout that retrieves data from a *. Txt file. For every line of data in the txt file, there will be one row of data.

Let's say I have two rows of data in the txt file right now, it makes sense that two tablerows will be generated. Then, I added a OnLongPressListener which, when called, will delete one row of data from the txt file. Now's the first question: After deleting data in the txt file, how do I refresh my tablelayout to reflect that change?

Second question is: After I get my first question solved, is it possible to have some kind of animation where one row will fade out or slide out instead of just disappearing outright? Thanks! Java android refresh tablelayout tablerow link|improve this question asked Apr 15 '11 at 17:55Danny61.

You need to accept answers that worked for you so that next time you ask questions - people don't hesitate to post answers! – Sagar Hatekar Apr 20 '11 at 3:18.

It gives you better control when using an MVC model where there's a dataset tied to a View. So you could have a class that extends BaseAdapter. This class binds your data to the View and this class also has a method: notifyDataSetChanged() which is what should solve your problem.

You may find notifyDataSetChanged example and customListView helpful. Let me know if you need any help further.

I agree list is a much better way to go. And a possible animation solution would be easier to find/create. – Wayner Apr 15 '11 at 18:09 Alright I tried your suggestion but it's nearly impossible (or I just don't know how to do it right) to convert my setup to listview.

What I have is a background picture of a resistor and four textview (each with no text but different background colours). You see how that's working? I tried applying listview and customizing my own simple_list.

Xml to have a background of a resistor. But I don't know how to add four textview to one row of listview. – Danny Apr 15 '11 at 18:50 Okay.

I don't know how your four TextViews will appear but row. Xml in the tutorial already has two TextViews so you just add two more, shouldn't that be easy? – Sagar Hatekar Apr 15 '11 at 20:13 Accept the answer that helped you so that answers may know what worked for you.

Happy Coding! – Sagar Hatekar Apr 15 '11 at 4:16.

Generally in onCreate() we do all the stuff that shows the ui with text, try to put the code that makes up UI in a private method say setUpTabView() and try to call this from onCreate and even try calling this setUpTabView() when ever the text changed. This kind of approach I did in grid view. Worked very well...!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions