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:org.catrobat.catroid.ui.ScratchConverterActivity.java

private void setUpActionBar() {
    final ActionBar actionBar = getActionBar();
    actionBar.setTitle(R.string.title_activity_scratch_converter);
    actionBar.setHomeButtonEnabled(true);
}

From source file:com.albertcbraun.wifidlitedemoapp.MainActivity.java

void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    //noinspection deprecation
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}

From source file:de.mtrstudios.nflpickem.UI.Highscores.HighscoresActivity.java

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

    ButterKnife.inject(this);

    // Set up the action bar.
    final ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setTitle(getString(R.string.highscores));
    actionBar.setDisplayHomeAsUpEnabled(true);

    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());
    mSectionsPagerAdapter.setWeeks(appData.getSeasonInfo().getWeek());

    // Set up the ViewPager with the sections adapter.
    mViewPager.setAdapter(mSectionsPagerAdapter);

    // When swiping between different sections, select the corresponding
    // tab. We can also use ActionBar.Tab#select() to do this if we have
    // a reference to the Tab.
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override/*  w  ww. j  a  va  2 s.  c  om*/
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
        }
    });

    // For each of the sections in the app, add a tab to the action bar.
    for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by
        // the adapter. Also specify this Activity object, which implements
        // the TabListener interface, as the callback (listener) for when
        // this tab is selected.
        actionBar
                .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
    }
}

From source file:com.tweetlanes.android.core.view.DirectMessageActivity.java

void configureActionBarView() {

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(getString(R.string.dm_title) + getOtherUserScreenName());
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
}

From source file:com.ternup.caddisfly.activity.MainActivity.java

@Override
public void setTitle(CharSequence title) {
    mTitle = title;//  w ww . ja v a2s  .  co m
    ActionBar actionBar = getActionBar();
    assert actionBar != null;
    actionBar.setTitle(title);
}

From source file:com.plnyyanks.frcnotebook.activities.ViewEvent.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(PreferenceHandler.getTheme());
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_event);

    activity = this;

    if (event == null) {
        Intent intent = new Intent(this, StartActivity.class);
        startActivity(intent);/*from  w  ww  .  j ava 2  s  .  c  om*/
        return;
    }

    ActionBar bar = getActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setTitle(event.getEventName());
    bar.setSubtitle("#" + key);
    bar.setDisplayHomeAsUpEnabled(true);

    //tab for team list
    ActionBar.Tab teamListTab = bar.newTab();
    teamListTab.setText("Teams Attending");
    teamListTab.setTabListener(this);
    bar.addTab(teamListTab);

    //tab for match schedule
    ActionBar.Tab scheduleTab = bar.newTab();
    scheduleTab.setText("Match Schedule");
    scheduleTab.setTabListener(this);
    bar.addTab(scheduleTab);

    if (savedInstanceState != null) {
        bar.setSelectedNavigationItem(savedInstanceState.getInt(STATE_SELECTED_NAVIGATION_ITEM, 0));
    } else {
        bar.setSelectedNavigationItem(0);
    }
}

From source file:org.yuzhiqiang.itsmine.MainActivity.java

public void restoreActionBar() {
    final ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(getTitle());
    }/*  w w  w .j  a  v  a 2 s . c o  m*/
}

From source file:com.notriddle.budget.EnvelopesActivity.java

private void setupDrawer() {
    mNavDrawer = (ListView) findViewById(R.id.left_drawer);
    mNavAdapter = new NavAdapter(this);
    mNavDrawer.setAdapter(mNavAdapter);//from   w  w w  .  j av  a  2s .c o m
    mNavDrawer.setOnItemClickListener(this);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mNavToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer,
            R.string.drawerOpen_button, R.string.drawerClose_button) {
        @Override
        public void onDrawerClosed(View v) {
            super.onDrawerClosed(v);
            ActionBar ab = getActionBar();
            ab.setTitle(getTitle());
            invalidateOptionsMenu();
            if (mCustomActionBarView != null) {
                ab.setCustomView(mCustomActionBarView);
                ab.setDisplayShowTitleEnabled(false);
                ab.setDisplayShowCustomEnabled(true);
            }
        }

        @Override
        public void onDrawerSlide(View v, float off) {
            super.onDrawerSlide(v, off);
            int allIn = mColor;
            int allOut = 0xFFEEEEEE;
            int result = Color.rgb((int) (Color.red(allIn) * (1 - off) + Color.red(allOut) * off),
                    (int) (Color.green(allIn) * (1 - off) + Color.green(allOut) * off),
                    (int) (Color.blue(allIn) * (1 - off) + Color.blue(allOut) * off));
            mActionBarColor.setColor(result);
        }

        @Override
        public void onDrawerOpened(View v) {
            super.onDrawerOpened(v);
            ActionBar ab = getActionBar();
            ab.setTitle(getString(R.string.app_name));
            invalidateOptionsMenu();
            if (mCustomActionBarView != null) {
                ab.setDisplayShowTitleEnabled(true);
                ab.setDisplayShowCustomEnabled(false);
                ab.setCustomView(null);
            }
        }
    };
    mDrawerLayout.setDrawerListener(mNavToggle);
    getActionBar().setHomeButtonEnabled(true);
    getActionBar().setDisplayHomeAsUpEnabled(true);
}

From source file:com.google.cloud.genomics.android.fragments.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 ww  . ja  v  a  2 s  .c o m
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(R.string.app_name);
}

From source file:com.cyanogenmod.settings.device.DeviceSettings.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mViewPager = new ViewPager(this);
    mViewPager.setId(R.id.viewPager);/*ww w . ja  v a  2  s.  co  m*/
    setContentView(mViewPager);

    final ActionBar bar = getActionBar();
    bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
    bar.setTitle(R.string.app_name);

    mTabsAdapter = new TabsAdapter(this, mViewPager);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.category_screen_title), ScreenFragmentActivity.class,
            null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.category_sensors_title), SensorsFragmentActivity.class,
            null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.category_haptic_title), HapticFragmentActivity.class,
            null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.category_storage_title), StorageFragmentActivity.class,
            null);
    mTabsAdapter.addTab(bar.newTab().setText(R.string.category_dock_title), DockFragmentActivity.class, null);

    if (savedInstanceState != null) {
        bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0));
    }
}