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:Main.java

public static void setTitleDefault(ActionBar actionBar, CharSequence title) {
    if (actionBar == null) {
        return;// w  ww.j  av a 2  s  .c  o  m
    }
    actionBar.setTitle(title);
    actionBar.setSubtitle(null);
    actionBar.show();
}

From source file:Windows.UI.Xaml.Controls.CommandBar.java

public static void remove(android.app.Activity activity, android.view.Menu menu) {
    //if (!(activity instanceof ActionBarActivity)) {
    android.app.ActionBar mainActionBar = activity.getActionBar();
    if (mainActionBar != null) {
        mainActionBar.hide();//from ww  w  . ja v  a 2  s  .  c  o  m
        mainActionBar.setTitle(null);
        menu.clear();
        return;
    }
    //}
    //else {
    //    ActionBar actionBar = ((ActionBarActivity)activity).getSupportActionBar();
    //    if (actionBar != null) {
    //        actionBar.hide();
    //        actionBar.setTitle(null);
    //        menu.clear();
    //        return;
    //    }
    //}
}

From source file:com.android.packageinstaller.permission.ui.PermissionAppsFragment.java

private static void bindUi(Fragment fragment, PermissionApps permissionApps) {
    final Drawable icon = permissionApps.getIcon();
    final CharSequence label = permissionApps.getLabel();
    final ActionBar ab = fragment.getActivity().getActionBar();
    if (ab != null) {
        ab.setTitle(fragment.getString(R.string.permission_title, label));
    }//  w ww.  ja v  a 2  s .  c  o  m

    final ViewGroup rootView = (ViewGroup) fragment.getView();
    final ImageView iconView = (ImageView) rootView.findViewById(R.id.lb_icon);
    if (iconView != null) {
        // Set the icon as the background instead of the image because ImageView
        // doesn't properly scale vector drawables beyond their intrinsic size
        iconView.setBackground(icon);
    }
    final TextView titleView = (TextView) rootView.findViewById(R.id.lb_title);
    if (titleView != null) {
        titleView.setText(label);
    }
    final TextView breadcrumbView = (TextView) rootView.findViewById(R.id.lb_breadcrumb);
    if (breadcrumbView != null) {
        breadcrumbView.setText(R.string.app_permissions);
    }
}

From source file:com.learnit.LearnIt.activities.InfoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.info);//  w w  w.j  a  v  a  2 s. c om
    ActionBar actionBar = this.getActionBar();
    if (actionBar != null) {
        actionBar.setTitle("");
    }
    TextView txtVersion = (TextView) findViewById(R.id.instructions_title);
    String currentStr = txtVersion.getText().toString();
    Log.d(Constants.LOG_TAG, currentStr);
    txtVersion.setText(String.format(currentStr, getString(R.string.version)));
}

From source file:org.isoron.uhabits.ShowHabitActivity.java

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

    Uri data = getIntent().getData();//from w  w  w. ja v a2  s .c  om
    habit = Habit.get(ContentUris.parseId(data));
    ActionBar actionBar = getActionBar();

    if (actionBar != null) {
        actionBar.setTitle(habit.name);

        if (android.os.Build.VERSION.SDK_INT >= 21)
            actionBar.setBackgroundDrawable(new ColorDrawable(habit.color));
    }

    setContentView(R.layout.show_habit_activity);

    fragment = (ShowHabitFragment) getFragmentManager().findFragmentById(R.id.fragment2);

    receiver = new Receiver();
    localBroadcastManager = LocalBroadcastManager.getInstance(this);
    localBroadcastManager.registerReceiver(receiver, new IntentFilter(MainActivity.ACTION_REFRESH));
}

From source file:com.mani.volleydemo.SSLConnectionActivity.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void actionBarSetup() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        ActionBar ab = getActionBar();
        ab.setTitle("SSL Connection");
    }/*from   ww w .  j a  v  a2 s  . c om*/
}

From source file:de.da_sense.moses.client.SurveyActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_surveyactivity);

    if (mAPKID == null)
        if (savedInstanceState == null)
            mAPKID = getIntent().getStringExtra(ExternalApplication.KEY_APK_ID);
        else//from w  w w.j  a v a  2s  .com
            mAPKID = savedInstanceState.getString(ExternalApplication.KEY_APK_ID, null);

    if (mAPKID == null)
        Log.e(LOG_TAG, "onCreate() apkid was not in the bundle nor in the intent");

    int belongsTo = getIntent().getIntExtra(WelcomeActivity.KEY_BELONGS_TO,
            WelcomeActivityPagerAdapter.TAB_RUNNING);
    ExternalApplication apk;
    if (belongsTo == WelcomeActivityPagerAdapter.TAB_HISTORY)
        apk = HistoryExternalApplicationsManager.getInstance().getAppForId(mAPKID);
    else
        apk = InstalledExternalApplicationsManager.getInstance().getAppForId(mAPKID);

    // get ActionBar and set AppIcon to direct to the "home screen"
    ActionBar ab = getActionBar();
    ab.setTitle(String.format(getString(R.string.actionbar_title_survey), apk.getName()));
    ab.setDisplayHomeAsUpEnabled(true);

    // set the adapter
    mAdapter = new SurveyActivityPagerAdapter(getSupportFragmentManager(), apk);
    mViewPager = (ViewPager) findViewById(R.id.surveyActivityPager);
    mViewPager.setAdapter(mAdapter);
}

From source file:com.example.android.oauthTesting_slidingTabBasic.MainActivity.java

public void setActionBarTitle(String title) {
    ActionBar bar = this.getActionBar();
    if (bar != null) {
        bar.setTitle(R.string.app_name);
    }//from  w w  w.ja  v  a  2  s.  c o  m
}

From source file:com.google.cloud.genomics.android.MainActivity.java

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

From source file:com.google.dartino.githubsample.MainActivity.java

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