Thomas
Thomas

Reputation: 491

Grabbing the TabHost view from within a tab

Now I got a TabHost with several tabs, and in order to simplify the views and reuse TextViews I have created the TabHost in such a was that common information resides in the TabHost view, instead of all Tabs having the same TextViews.

Here is a quick schematic of the TabHost view.

|------------|
| name  $$$  |
|------------|
| TabContent |
|            |
|            |
|------------|
|Tab Tab Tab |
|------------|

The main Activity that extends TabActivity is MainActivity, and I have started the three tabs using Intent.

Now for the issue at hand, in the StatusActivity I would like to update the 'name' and '$$$' textviews (which both are defined in the view belonging to the MainActivity.

Maybe this is a stupid way to handle this, but I figured that since Name and Rank will be shown on every view I figured that placing them one place and just updating $$$ when the sum changes was a good idea.

But whatevery to try, I can't seem to get the $$$ TextView.

Upvotes: 0

Views: 66

Answers (1)

Manitoba
Manitoba

Reputation: 8702

Try that:

TabActivity ta = ((TabActivity) getParent());

So that, if you want to get the TabHost:

((TabActivity) getParent()).getTabHost();

Upvotes: 1

Related Questions