aspose file tools*
The moose likes Android and the fly likes Creating multiple tabs :one after another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Creating multiple tabs :one after another" Watch "Creating multiple tabs :one after another" New topic
Author

Creating multiple tabs :one after another

Prajkti Khadse
Ranch Hand

Joined: Apr 02, 2009
Posts: 52
Hi all,
In my application, i want to create multiple tabs.
For example, i have a button on clicking which should create one more tab,(just like mozilla browser).
I searched on Internet as well as Android Documentation.. but did not get any clue...

Can anybody please help me..??
Mark L. Murphy
Author
Ranch Hand

Joined: Feb 11, 2009
Posts: 131
http://developer.android.com/guide/tutorials/views/hello-tabwidget.html


Mark Murphy (a Commons Guy)
Author of The Busy Coder's Guide to Android Development http://commonsware.com/Android/
Prajkti Khadse
Ranch Hand

Joined: Apr 02, 2009
Posts: 52
Thanks Mark,
I already referred that...
What i want actually is to create a new tab when user Clicks on "New Tab" menu or button..

Is it really possible??
Pratik Goswami
Ranch Hand

Joined: Mar 02, 2009
Posts: 136

Hi Prajakti,

Here it is,

Main class - TabActivityDemo


Layout - tabview.xml

Tab layout class - ChildTab


Just modify according to your requirement.
Have fun!!!

Thanks & Regards
Pratik Goswami


iOS * Android Developer
Prajkti Khadse
Ranch Hand

Joined: Apr 02, 2009
Posts: 52
Thanks Pratik,
one more question...

can we change title (i.e indicator) of tab on particular event??
i mean once the tab is added to TabHost, is it possible to modify it??
Pratik Goswami
Ranch Hand

Joined: Mar 02, 2009
Posts: 136

Hi,

I have created a multiple instances of a single TabSpec object, you can create multiple objects of TabSpec fit to your requirement. After creating object you can change their property at specific event. You can create TabSpec's object array and add them with a loop. Apply your own logic to mess up with tab bar.


Thanks & Regards
Pratik Goswami
Prajkti Khadse
Ranch Hand

Joined: Apr 02, 2009
Posts: 52
Thanks,
i'l try it..
 
jQuery in Action, 2nd edition
 
subject: Creating multiple tabs :one after another