3

I want to know that how can i use the different title for each activity using ActionBarSherlock. Like Setting's Activity should label Settings on the title bar etc

public class Main extends SherlockActivity implements OnClickListener, OnItemClickListener, OnItemLongClickListener
Saqib Vohra
  • 366
  • 7
  • 17

5 Answers5

5

in each activity you can call programmatically

ActionBar actionBar = getSupportActionBar();
actionBar.setTitle(title);

it takes as parameter both an int or a charsequence. Lile setText of a TextView

Blackbelt
  • 156,034
  • 29
  • 297
  • 305
1

You mean how to set the title in the Actionbar? In that case it is:

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getSupportActionBar().setTitle(R.string.yourString);
....
Thomas Kaliakos
  • 3,274
  • 4
  • 25
  • 39
0

If I understood the question correctly, you can do this by:

<activity android:name=".ActivityName"
    android:label="@string/settings">
</activity>

And to do this for each of your activities, which are defined in the AndroidManifest.

g00dy
  • 6,752
  • 2
  • 30
  • 43
0

This is the way to set tile..

    ActionBar ab = getActionBar();
    ab.setTitle("My Title");
Shani Goriwal
  • 2,111
  • 1
  • 18
  • 30
0

u can use it in your manifest where you declare

   <activity android name ".pckgname"
            android : label = "activity name"   
            >
 </actrivity>

and remove this method from your activity

       this.requestWindowFeature(Window.FEATURE_NO_TITLE);