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.richtodd.android.quiltdesign.app.QuiltEditActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_quilt_edit);
    getActionBar().setDisplayHomeAsUpEnabled(true);

    m_quiltNameArgument = getIntent().getStringExtra(ARG_QUILT_NAME);

    if (savedInstanceState != null) {
        m_saveAsQuiltName = savedInstanceState.getString("saveAsQuiltName");
    }//  w  ww.  ja  v a2 s  .  c  o  m

    ActionBar ab = getActionBar();
    ab.setTitle("Edit Quilt");
    ab.setSubtitle(getCurrentQuiltName());

    FragmentManager fm = getFragmentManager();

    // Create color settings fragment.
    {
        Fragment fragment = fm.findFragmentById(R.id.layout_quiltEditFragment);
        if (fragment == null) {
            fragment = QuiltEditFragment.create(m_quiltNameArgument);
            fm.beginTransaction().add(R.id.layout_quiltEditFragment, fragment).commit();
        }
    }

    m_layout_blocks = (NestedLinearLayout) findViewById(R.id.layout_blocks);

    populateLayoutBlocks();
}

From source file:com.ternup.caddisfly.fragment.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.
 *///  w  w  w. java 2  s  . c om
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.appName);
}

From source file:app.philm.in.AndroidDisplay.java

@Override
public void setActionBarTitle(CharSequence title) {
    ActionBar ab = mActivity.getActionBar();
    if (ab != null) {
        if (mColorScheme != null) {
            ab.setTitle(convertToCondensed(title, mColorScheme.primaryText));
        } else {//from   w w  w  .  j a v a 2 s  .c o  m
            ab.setTitle(convertToCondensed(title));
        }
    }
}

From source file:fr.cph.chicago.fragment.drawer.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./*ww  w.j  av  a  2s  .co  m*/
 */
private final void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}

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

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

From source file:com.application.treasurehunt.ScanQRCodeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scan_qrcode);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        ActionBar actionBar = getActionBar();
        actionBar.setTitle("Treasure Hunt");
        actionBar.setSubtitle("Scan a QR code");
    }//from  w  ww. j ava 2s .  c om

    mScanButton = (Button) findViewById(R.id.scan_qr_code_button);
    mQuestionReturned = (TextView) findViewById(R.id.scan_content_received);

    mMapManager = MapManager.get(this);
    mLocationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);

    mMapDataSource = MapDataDAO.getInstance(this);
    mMapDataSource.open();

    mSettings = getSharedPreferences("UserPreferencesFile", 0);
    mEditor = mSettings.edit();

    //http://developer.android.com/guide/topics/data/data-storage.html#pref
    mCurrentHuntId = mSettings.getInt("currentHuntId", 0);
    mCurrentParticipantId = mSettings.getInt("huntParticipantId", 0);

    Log.i("ScanQRCode", "The hunt retrieved from the editor is: " + mCurrentHuntId);

    if (savedInstanceState == null) {
        checkLocationServices();
    }

    ScanQRCodeActivity.this.registerReceiver(mLocationReceiver, new IntentFilter(MapManager.ACTION_LOCATION));

    mScanButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mQuestionReturned.setText("");
            Intent intent = new Intent(ScanQRCodeActivity.this, ZBarScannerActivity.class);
            startActivityForResult(intent, 1);
        }
    });
}

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

private void configureFragment(Fragment frag) {
    ActionBar ab = getActionBar();
    if (frag instanceof TitleFragment) {
        TitleFragment tFrag = (TitleFragment) frag;
        setTitle(tFrag.getTitle());/* w w w .  j a  va 2 s . c o m*/
        ab.setTitle(getTitle());
        boolean isTopLevel = false;
        for (int i = 0; i != mNavAdapter.getCount(); ++i) {
            if (mNavAdapter.getItem(i) == frag.getClass()) {
                mNavDrawer.setItemChecked(i, true);
                isTopLevel = true;
                break;
            } else {
                mNavDrawer.setItemChecked(i, false);
            }
        }
        mNavToggle.setDrawerIndicatorEnabled(isTopLevel);
    } else {
        throw new Error("Top-level fragment must be a TitleFragment");
    }
    if (frag instanceof DialogFragment) {
        DialogFragment dFrag = (DialogFragment) frag;
        dFrag.setShowsDialog(false);
    }
    if (frag instanceof ColorFragment) {
        ColorFragment cFrag = (ColorFragment) frag;
        onColorChange(cFrag.getColor());
    } else {
        onColorChange(0);
    }
    if (frag instanceof CustomActionBarFragment) {
        CustomActionBarFragment cFrag = (CustomActionBarFragment) frag;
        mCustomActionBarView = cFrag.onCreateActionBarView(getLayoutInflater());
        ab.setCustomView(mCustomActionBarView);
        ab.setDisplayShowTitleEnabled(false);
        ab.setDisplayShowCustomEnabled(true);
    } else {
        mCustomActionBarView = null;
        ab.setDisplayShowTitleEnabled(true);
        ab.setDisplayShowCustomEnabled(false);
        ab.setCustomView(null);
    }
}

From source file:com.tatteam.patente.ui.fragment.DoExamsFragment.java

@Override
protected void setupActionBar(ActionBar actionBar) {
    super.setupActionBar(actionBar);
    actionBar.setTitle(getString(R.string.exam_num) + " " + StringUtil.formatNumber(sheetNo));
}

From source file:com.techsoc.cultureconnect.navigation.NavigationActivity.java

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

    mTitle = mDrawerTitle = "";//getTitle();
    mOptions = getResources().getStringArray(R.array.options);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerListLeft = (ListView) findViewById(R.id.left_drawer);

    // set a custom shadow that overlays the main content when the drawer opens
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    // set up the drawer's list view with items and click listener
    mDrawerListLeft.setAdapter(new ArrayAdapter<String>(this, R.layout.nav_drawer_list_item, mOptions));
    mDrawerListLeft.setOnItemClickListener(new DrawerItemClickListener());

    ActionBar actionBar = getActionBar();
    actionBar.setIcon(R.drawable.culture_connect_white);
    actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.CultureConnect)));
    actionBar.setTitle(null);
    // enable ActionBar app icon to behave as action to toggle nav drawer
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);

    // ActionBarDrawerToggle ties together the the proper interactions
    // between the sliding drawer and the action bar app icon

    mDrawerToggleLeft = new ActionBarDrawerToggle(this, /* host Activity */
            mDrawerLayout, /* DrawerLayout object */
            R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
            R.string.drawer_open, /* "open drawer" description for accessibility */
            R.string.drawer_close /* "close drawer" description for accessibility */
    ) {//from  w ww . j  a  v  a 2  s .c om
        public void onDrawerClosed(View view) {
            getActionBar().setTitle(mTitle);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }

        public void onDrawerOpened(View drawerView) {
            getActionBar().setTitle(mDrawerTitle);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }
    };
    mDrawerLayout.setDrawerListener(mDrawerToggleLeft);

    if (savedInstanceState == null) {
        selectItem(0);
    }

}

From source file:com.cyanogenmod.eleven.ui.activities.BaseActivity.java

public void setActionBarTitle(String title) {
    ActionBar actionBar = getActionBar();
    actionBar.setTitle(title.toUpperCase());
}