Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7493881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:13:20+00:00 2026-05-29T17:13:20+00:00

I have a Tab that has a custom layout which contains a TextView .

  • 0

I have a Tab that has a custom layout which contains a TextView.
I will need to later update that text from the actual tab child.

Here’s how I set it up in the TabActivity

    private void setupTab(final String tag) {

//Call createTabView() to give the tab a layout with some text
        View tabview = createTabView(mTabHost.getContext(), tag);

        Intent intent = new Intent().setClass(this, MyActivity.class);
        TabSpec setContent = mTabHost.newTabSpec(tag).setIndicator(tabview).setContent(intent);

        mTabHost.addTab(setContent);
        mTabList.add(setContent);

    }


    private View createTabView(final Context context, final String text) {
            View view = LayoutInflater.from(context).inflate(R.layout.tabs_bg, null);
            TextView tv = (TextView) view.findViewById(R.id.tabsText);
            tv.setText(text); //we set the text of the tab here.

            LinearLayout tvX = (LinearLayout) view.findViewById(R.id.tabsLayout);

            return view;
        }

So there is how I set it up… Now, in the child tab’s activity I need it to update the text… I think the following would work if I didn’t have custom tabs…

((TabActivity)getParent()).getTabHost().setTag(((TabActivity)getParent()).getTabHost().getCurrentTab(), "new text");

But I need custom tabs 🙂

Does anyone have any ideas or suggestions?
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T17:13:25+00:00Added an answer on May 29, 2026 at 5:13 pm

    OK i got it figured out!

    In the TabActivity I have this method:

    protected void updateText(int key, String text) {
        View view = mTabHost.getCurrentTabView();
        TextView tv = (TextView) view.findViewById(R.id.tabsText);
        tv.setText(text);       
    }
    

    And then in my child tab I call this:

    ((MyTabActivity)getParent()).updateText(((TabActivity)getParent()).getTabHost().getCurrentTab(), "The new text");
    

    And now you know 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application which has a tabcontrol that contains two tabpages. I have
I have a tab-delimited file that has over 200 million lines. What's the fastest
Problem I have a custom tab control using Chrome-shaped tabs that binds to a
I'm trying to create a custom tab navigator that has to look like this
I created a custom view, which has one button and one text field ,
In my iPhone app I have implemented a custom tab bar which functions perfectly,
I have a custom control that is derived from ListView . This list view
I have an ASP.net page. That has an Ajax Toolkit Tab Control. That has
I have a tab page that should be hidden if a property (BlahType) is
My problem is that I want to have a tab bar view with its

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.