Friday, September 2, 2011

[android-developers] Re: How to close a single tab in tablayout

You simply need to save the information before clearAll and restore
them later.
However it seems that isn't a way to remove single tab using the
standard API.

On 2 Set, 14:26, sj <sujith...@gmail.com> wrote:
> There is a method to add a tab in TabHost as well as clear all tabs,
> but there are no APIs to remove one single tab.
>
> Following the logic in clearAllTabs tried to
> tabwidget.removeViewAt(index);
> tabHost.getTabContentView().removeViewAt(index)
>
> After this the behaviour is strange. I assume that is because the
> mTabSpecs still contain the tabspec reference. mTabSpecs is a private
> variable in TabHost and there are not get methods to get a handle to
> this.
>
> How to resolve the issue if one wants to close a single tab, and yes i
> have tried to clear all the tabs and add back all the tabspecs. It
> does not work for my usecase where some views contains some
> information regarding a session. If i recreate those tabspecs, i will
> go back to the starting point in those views.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment