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.android.ex.photo.PhotoViewActivity.java

/**
 * Adjusts the activity title and subtitle to reflect the photo name and count.
 *//* w  ww .  jav  a 2  s.c o m*/
protected void updateActionBar(PhotoViewFragment fragment) {
    final int position = mViewPager.getCurrentItem() + 1;
    final String title;
    final String subtitle;
    final boolean hasAlbumCount = mAlbumCount >= 0;

    final Cursor cursor = getCursorAtProperPosition();

    if (cursor != null) {
        final int photoNameIndex = cursor.getColumnIndex(PhotoContract.PhotoViewColumns.NAME);
        title = cursor.getString(photoNameIndex);
    } else {
        title = null;
    }

    if (mIsEmpty || !hasAlbumCount || position <= 0) {
        subtitle = null;
    } else {
        subtitle = getResources().getString(R.string.photo_view_count, position, mAlbumCount);
    }

    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.setTitle(title);
    actionBar.setSubtitle(subtitle);
}

From source file:com.antew.redditinpictures.library.ui.ImageViewerActivity.java

/**
 * Enable some additional newer visibility and ActionBar features to create a more
 * immersive photo viewing experience.//w ww.  j a v  a  2s  . com
 * <p/>
 * Initialize the mActionBarHeight variable.
 */
private void initializeActionBar() {
    final ActionBar actionBar = getActionBar();

    // Hide title text and set home as up
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(R.string.reddit_in_pictures);
    actionBar.setDisplayHomeAsUpEnabled(true);

    // Calculate ActionBar height
    TypedValue tv = new TypedValue();
    if (getTheme() != null && getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
        mActionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics());
    }
}

From source file:com.aniruddhc.acemusic.player.BlacklistManagerActivity.BlacklistManagerActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.blacklist_manager, menu);

    ActionBar actionBar = getActionBar();
    actionBar.setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext));
    SpannableString s = new SpannableString(getResources().getString(R.string.blacklist_manager));
    s.setSpan(new TypefaceSpan(this, "RobotoCondensed-Light"), 0, s.length(),
            Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    actionBar.setTitle(s);

    return super.onCreateOptionsMenu(menu);
}

From source file:com.untappedkegg.rally.home.ActivityMain.java

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

    if (actionBar != null) {
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(mActionBarDrawer[curPosition]);
    }/* www .j a va2  s . c  om*/
}

From source file:com.patil.geobells.lite.MainActivity.java

public void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(title);
}

From source file:io.indy.drone.activity.StrikeDetailActivity.java

private void configureActionBar() {
    // Show the Up button in the action bar.
    ActionBar actionBar = getActionBar();

    mSpinnerAdapter = ArrayAdapter.createFromResource(this, R.array.locations_array,
            android.R.layout.simple_spinner_dropdown_item);

    mOnNavigationListener = new ActionBar.OnNavigationListener() {
        public boolean onNavigationItemSelected(int itemPosition, long itemId) {
            onRegionSelected(itemPosition);
            return true;
        }/* w w w  . java 2 s. com*/
    };

    actionBar.setTitle("");
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actionBar.setListNavigationCallbacks(mSpinnerAdapter, mOnNavigationListener);

    try {
        actionBar.setSelectedNavigationItem(SQLDatabase.indexFromRegion(mRegion));
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.app.blockydemo.ui.fragment.FormulaEditorFragment.java

private void setUpActionBar() {
    ActionBar actionBar = getActivity().getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(R.string.formula_editor_title);
}

From source file:edu.pdx.cecs.orcycle.TabsConfig.java

@Override
public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
    try {/*from  w  ww.jav a 2  s.  c o  m*/
        // When the given tab is selected, switch to the corresponding page in
        // the ViewPager.
        // Toast.makeText(this, "TabSelected", Toast.LENGTH_LONG).show();
        mViewPager.setCurrentItem(tab.getPosition());
        final ActionBar actionBar = getActionBar();
        switch (tab.getPosition()) {
        case 0:
            actionBar.setDisplayShowTitleEnabled(false);
            actionBar.setDisplayShowHomeEnabled(false);
            break;
        case 1:
            actionBar.setDisplayShowTitleEnabled(true);
            actionBar.setDisplayShowHomeEnabled(true);
            actionBar.setTitle(R.string.app_name);
            break;
        case 2:
            actionBar.setDisplayShowTitleEnabled(true);
            actionBar.setDisplayShowHomeEnabled(true);
            actionBar.setTitle(R.string.app_name);
            break;
        case 3:
            actionBar.setDisplayShowTitleEnabled(true);
            actionBar.setDisplayShowHomeEnabled(true);
            actionBar.setTitle(R.string.app_name);
            break;
        }
    } catch (Exception ex) {
        Log.e(MODULE_TAG, ex.getMessage());
    }
}

From source file:org.catrobat.catroid.ui.MainMenuActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (!Utils.checkForExternalStorageAvailableAndDisplayErrorIfNot(this)) {
        return;//from ww  w  .j  a  va2  s .  co m
    }
    initializeFacebookSdk();

    PreferenceManager.setDefaultValues(this, R.xml.preferences, true);
    UtilUi.updateScreenWidthAndHeight(this);

    if (STANDALONE_MODE) {
        /*requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
           WindowManager.LayoutParams.FLAG_FULLSCREEN);*/
        getActionBar().hide();
        setContentView(R.layout.activity_main_menu_splashscreen);
        unzipProgram();
    } else {
        setContentView(R.layout.activity_main_menu);

        final ActionBar actionBar = getActionBar();
        actionBar.setDisplayUseLogoEnabled(true);
        actionBar.setHomeButtonEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(false);
        actionBar.setTitle(R.string.app_name);

        findViewById(R.id.main_menu_button_continue).setEnabled(false);

        // Load external project from URL or local file system.
        Uri loadExternalProjectUri = getIntent().getData();
        getIntent().setData(null);

        if (loadExternalProjectUri != null) {
            loadProgramFromExternalSource(loadExternalProjectUri);
        }
    }
}

From source file:com.retroteam.studio.retrostudio.MeasureEditor.java

/**
 * Set up the {@link android.app.ActionBar}, if the API is available.
 *//*from www  .  ja  v  a2  s.co m*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar(String title) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        // Show the Up button in the action bar.
        ActionBar measure = getActionBar();
        //actionMenu = measure;
        measure.setDisplayHomeAsUpEnabled(true);
        measure.setTitle("Editing Measure " + title.split(",")[0] + ", " + title.split(",")[1]);

    }
}