Android examples for android.app:Action Bar
set Support Action Bar Title
import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.net.Uri; import android.os.Build; import android.support.annotation.NonNull; import android.support.annotation.StringRes; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatDelegate; import android.view.View; import android.view.Window; public class Main{ /**/* w ww. j a v a 2 s .c o m*/ * Overloaded version of {@link #setSupportActionBarTitle(Activity, String)}. * * @param activity Activity to set action bar on. * @param titleID String ID of title. */ public static void setSupportActionBarTitle(@NonNull Activity activity, @StringRes int titleID) { setSupportActionBarTitle(activity, activity.getString(titleID)); } /** * Sets the support action bar title for the specified activity. * * @param activity Activity to set action bar on. Must be a {@link AppCompatActivity}. * @param title String title to set. */ public static void setSupportActionBarTitle(@NonNull Activity activity, String title) { ActionBar actionBar = ((AppCompatActivity) activity) .getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(title); } } }