this works for me, at end of ur code add this.

tabhost.setCurrentTab(1);

0 = 1st tab
1 = 2nd tab
2= 3rd tab so on...

-Murali

On Mar 8, 2:41 pm, "faisal.khan" <[email protected]> wrote:
> Following is the example of tabs with intent data.
>
> While debugging i found that always when first tab we add in tab host
> in our case following tab
>
> tabHost.addTab(tabHost.newTabSpec("tab1")
>                     .setIndicator("list")
>                     .setContent(new Intent(this, List1.class)));
>
> oncreate method of "List1" intent get called regardless it is our
> current tab or not even if i define tab2 as a current tab how to fix
> this ?
>
> public class Tabs3 extends TabActivity {
>
>     @Override
>     protected void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>
>         final TabHost tabHost = getTabHost();
>
>         tabHost.addTab(tabHost.newTabSpec("tab1")
>                 .setIndicator("list")
>                 .setContent(new Intent(this, List1.class)));
>
>         tabHost.addTab(tabHost.newTabSpec("tab2")
>                 .setIndicator("photo list")
>                 .setContent(new Intent(this,
> List8.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));
>     }
>
> }
>
> I want to add all the tabs, but have something other than the first
> tab be selected on default, and don't want the List1 Activity to be
> created until you click on the tab.

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to