Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing title of tabbar in android

I googled this but couldn't find any solution please help. I have created a tabbar view having 3 tabs with Tabhost and set its title with TabSpec like this :

TabSpec tbhome = tabHost.newTabSpec("Home");
tbhome.setIndicator("Selected Topic");

I have 2 buttons in my another tab which is next to above tab. Now what I want is, if I click a button in this tab the title for this button must be set to the title of my home tab. That is in above code "Selected Topic " must be set to my button's title.

Thanks.

like image 297
Vish Avatar asked Aug 18 '13 07:08

Vish


1 Answers

first you get the button and make it final then on click set its text

        final Button bX = (Button) findViewById(R.id.bXX);
        bX.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                    bX.setText("Selected Topic ");
            }
        });
like image 184
Ahmed Ekri Avatar answered Oct 22 '22 12:10

Ahmed Ekri