Example usage for android.app ActionBar setTitle

List of usage examples for android.app ActionBar setTitle

Introduction

In this page you can find the example usage for android.app ActionBar setTitle.

Prototype

public abstract void setTitle(@StringRes int resId);

Source Link

Document

Set the action bar's title.

Usage

From source file:com.example.adbird.MenuTabActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tab_menu);//from  w  w w.  j av  a2 s .com
    mContext = this.getApplicationContext();

    SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE);
    String lang = prefs.getString("lang", null);
    Locale locale = new Locale(lang);
    Locale.setDefault(locale);
    Configuration config = new Configuration();
    config.locale = locale;
    getBaseContext().getResources().updateConfiguration(config,
            getBaseContext().getResources().getDisplayMetrics());
    SpannableString s = new SpannableString(mContext.getResources().getString(R.string.ads_title));
    s.setSpan(new TypefaceSpan(this, "GothaProReg.otf"), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager());

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();
    actionBar.setTitle(s);
    actionBar.setHomeButtonEnabled(false);

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mAppSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);

            SpannableString s = new SpannableString(mAppSectionsPagerAdapter.getPageTitle(position));
            s.setSpan(new TypefaceSpan(getApplicationContext(), "GothaProReg.otf"), 0, s.length(),
                    Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

            actionBar.setTitle(s);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) {
        actionBar.addTab(
                actionBar.newTab().setIcon(mAppSectionsPagerAdapter.getPageIcon(i)).setTabListener(this));

    }

}

From source file:it.polimi.spf.app.navigation.NavigationDrawerFragment.java

/**
 * Per the navigation drawer design guidelines, updates the action bar to
 * show the global app 'context', rather than just what's in the current
 * screen.//from  w w w. j  ava  2  s  . co  m
 */
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    //actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}

From source file:org.catnut.fragment.ConversationFragment.java

@Override
public void onStart() {
    super.onStart();
    ActionBar bar = getActivity().getActionBar();
    bar.setIcon(R.drawable.ic_action_conversation);
    bar.setTitle(getString(R.string.received_reply));
}

From source file:com.yattatech.dbtc.activity.AbstractChainTaskScreen.java

protected void setActionBar() {
    final int color = getResources().getColor(R.color.grey2);
    final ActionBar actionBar = getActionBar();
    actionBar.setIcon(R.drawable.ic_calen);
    actionBar.setTitle(R.string.app_name);
    actionBar.setBackgroundDrawable(new ColorDrawable(color));
}

From source file:org.catnut.fragment.MyRelationshipFragment.java

@Override
public void onStart() {
    super.onStart();
    ActionBar bar = getActivity().getActionBar();
    bar.setIcon(R.drawable.ic_title_people);
    bar.setTitle(getString(mIsFollowing ? R.string.my_followings_title : R.string.follow_me_title));
}

From source file:com.SpitsinStafichuk.vkazam_remastered.DrawerActivity.java

public void restoreActionBar() {
    ActionBar actionBar = getActionBar();

    if (actionBar != null) {
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(mTitle);
    }// ww  w . j  a v  a2s  .com
}

From source file:org.jorge.lolin1.ui.activities.DrawerLayoutFragmentActivity.java

protected void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(Boolean.TRUE);
    actionBar.setTitle(mTitle);
}

From source file:com.yangtsaosoftware.pebblemessenger.activities.NavigationActivity.java

public void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(mTitle);
    }/*from   www  .j a v  a2s.  c  o  m*/

}

From source file:com.burntout.burntout.AddCarActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.add_car_activity);

    ActionBar bar = getActionBar();
    bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#1E5791")));
    bar.setTitle("Burnt Out");
    bar.setSubtitle("Add Vehicle");
    bar.setDisplayHomeAsUpEnabled(true);

    //adapter = new AutopickerArrayAdapter(this, R.layout.add_car_activity, autopickerValues);

    makeModelEntry = (EditText) findViewById(R.id.make_model);
    plateNumberEntry = (EditText) findViewById(R.id.plate_number);
    pageMarkers = (PageMarkers) findViewById(R.id.pageMarkersAdd);
    pageMarkers.setTotalPages(4);/*  w w  w  . j  a  v a2 s  . c  o  m*/
    pageMarkers.makeView(0);

    Context context = this;

    SharedPreferences sharedPref = context.getSharedPreferences(getString(R.string.pref), Context.MODE_PRIVATE);

    email = sharedPref.getString("email", null);

    vehicleTypeHSV = (VehicleTypeHSV) findViewById(R.id.addVehicleTypeHSV);
    vehicleTypeHSV.setComm(this);
    vehicleTypeHSV.initItems(this);
    vehicleTypeHSV.setFeatureItems();
    vehicleTypeHSV.addManagers(this);

    statePicker = (StatePicker) findViewById(R.id.statepicker_view2);

    submitBtn = (Button) findViewById(R.id.submit_button_addcar);

    addListenerOnSubmit();

}

From source file:org.orange.querysystem.ScoresActivity.java

@TargetApi(11)
@Override//from   www.  j  a  v  a  2 s .c  o  m
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_tabs_pager);

    mTabHost = (TabHost) findViewById(android.R.id.tabhost);
    mTabHost.setup();

    mViewPager = (ViewPager) findViewById(R.id.pager);

    mTabsAdapter = new TabsAdapter(this, mTabHost, mViewPager);

    //3.0ActionBar
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        //Title
        findViewById(R.id.currentTime).setLayoutParams(new LinearLayout.LayoutParams(0, 0));
        ActionBar mActionBar = getActionBar();
        mActionBar.setTitle(R.string.transcripts);
        //????ActionBar
        if (getResources()
                .getConfiguration().orientation == android.content.res.Configuration.ORIENTATION_LANDSCAPE) {
            mActionBar.hide();
        }
    } else {
        //Title
        ((TextView) findViewById(R.id.currentTime)).setText(R.string.transcripts);
    }

    if (savedInstanceState == null) {
        authenticated = !SettingsActivity.requestPasswordForPrivateInformation(this);
        if (authenticated) {
            enterActivity();
        } else {
            showDialog(PASSWORD_PROMPT);
        }
    } else {
        authenticated = savedInstanceState.getBoolean(KEY_AUTHENTICATED, false);
        if (authenticated) {
            currentTab = savedInstanceState.getString(KEY_CURRENT_TAB);
            enterActivity();
        }
    }
}