I have a problem with removeAllViews and setContentView..... both are not working for me i don't know why. I have a function in a class that return a view and i want to add that view to the screen and that view will be change after every 5 second..... so after 5 second i call removeAllViews on the layout in which the view is added and then add it again.... but surprisingly the old view is still there and it add the new view at the end....
Same problem with the setContentView i try this also but it also work same as main layout it also add the view at the end not replace the whole screen.......
please help...... thanks in advance............
setContentView(logic.getView());
and
LinearLayout layout = blah blah blah;
layout.removeAllViews();
layout.addView(logic.getView(), layout parameters....);
Ok. With some of the review of your comments i got why this issue is created.
May be You are not removing the first View properly. Thats why while you are going to add another view, there are two views(1st is previous one and second is newly added view) instead of the one new View.
So remove the first view properly and then add the view as you want.
Hope it will help you.
Thanks.
Enjoy. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With