Any luck with this? I am in a similar situation.

Thanks
S

On Jul 21, 7:46 pm, 6real <[email protected]> wrote:
> Dear all,
>
> I have atabactivitywith several tabs. They are all defined with
> intents. On one tab, I have an action that needs to bring me to
> another tab and with a specific data.
>
> I worked with Intents and I broadcast them to change the tab. For that
> I have no problem.
>
> But I am facing an issue as soon as I try to reset my tabs for the
> second time (when the application starts, my method does not fail
> while called for the second time it throws an exception). The issue
> comes only If I call the clearAllTabs() method on TabHost.
>
> Here is the exception :
>
> 07-21 19:40:16.327: ERROR/AndroidRuntime(3308): Caused by:
> java.lang.NullPointerException
>     at android.widget.TabWidget.setCurrentTab(TabWidget.java:164)
>     at android.widget.TabWidget.focusCurrentTab(TabWidget.java:188)
>   at android.widget.TabHost.setCurrentTab(TabHost.java:307)
>  at android.widget.TabHost.addTab(TabHost.java:203)
> at .ACTIVITY.initTabs(ACTIVITY.java:40)
> 07-21 19:40:16.327: ERROR/AndroidRuntime(3308):     at
> <package>TabChanger.onReceive(TabChanger.java:30)
> 07-21 19:40:16.327: ERROR/AndroidRuntime(3308):     at
> android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run
> (ActivityThread.java:664)
>
> Here is the method to init the tabs :
>
> public void initTabs(Intent mapIntent){
>                 TabHost tabHost = getTabHost();
>                 tabHost.clearAllTabs();
>
>                 
> tabHost.addTab(tabHost.newTabSpec("TAB1").setIndicator(getString
> (R.string.tab_title_fav),
>                                 
> getResources().getDrawable(R.drawable.img_star)).setContent(
>                                 new Intent(this, 
> FavoriteListActivity.class)));
>
>                 
> tabHost.addTab(tabHost.newTabSpec("TAB2").setIndicator(getString
> (R.string.tab_title_search),
>                                 
> getResources().getDrawable(R.drawable.img_search)).setContent(
>                                 new Intent(this, 
> SearchForBikesOrSlotsActivity.class)));
>
>                 mapTab = tabHost.newTabSpec("TAB3").setIndicator(getString
> (R.string.tab_title_map),
>                                 
> getResources().getDrawable(R.drawable.img_map)).setContent
> (mapIntent);
>
>                 tabHost.addTab(mapTab);
>
>                 
> tabHost.addTab(tabHost.newTabSpec("TAB4").setIndicator(getString
> (R.string.tab_title_timer),
>                                 
> getResources().getDrawable(R.drawable.img_timer)).setContent(
>                                 new Intent(this, 
> NewStationActivityStep1.class)));
>         }
>
> I also tries to keep an handle on the tab I'd like to change (the map
> one), in order to change its content but still no success (the content
> does not change).
>
> ANy help will be highly appreciated XD
>
> Rgds
>
> C.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to