Java Code Examples for android.app.ActionBar#setTitle()

The following examples show how to use android.app.ActionBar#setTitle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DConnectServiceListActivity.java    From DeviceConnect-Android with MIT License 6 votes vote down vote up
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_service_list);

    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_HOME);
        actionBar.setTitle(R.string.activity_service_list_title);
    }

    mManualActivity = getSettingManualActivityClass();

    bindMessageService();
}
 
Example 2
Source File: PostActivity.java    From kylewbanks.com-AndroidApp with The Unlicense 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.post_view);

    //Determine which post we are showing
    KWBApplication application = (KWBApplication) getApplication();
    Intent intent = getIntent();
    post = application.getPostById(intent.getLongExtra("postId", -1));

    //Customize the action bar
    ActionBar actionBar = getActionBar();
    if(actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(post.getTitle());
        actionBar.setDisplayUseLogoEnabled(false);
    }

    //Get references to needed UI components
    contentView = (WebView) findViewById(R.id.post_content);
}
 
Example 3
Source File: MainActivity.java    From android-sectioned-adapter with MIT License 5 votes vote down vote up
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    ActionBar actionBar = this.getActivity().getActionBar();
    if (actionBar != null) {
        actionBar.setTitle(this.getTitle(sectionNumber));
    }
}
 
Example 4
Source File: FavoriteFragment.java    From catnut with MIT License 5 votes vote down vote up
@Override
public void onStart() {
	super.onStart();
	ActionBar actionBar = getActivity().getActionBar();
	actionBar.setTitle(getString(R.string.my_favorites));
	actionBar.setIcon(R.drawable.ic_title_favorite);
}
 
Example 5
Source File: ActionBarHelper.java    From FontsManager with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 设置标题
 *
 * @param actionBar       标题栏
 * @param spannableString 格式化后的标题
 */
public static void setTitle(ActionBar actionBar, SpannableString spannableString) {
    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN && Build.MANUFACTURER.toUpperCase().equals("LGE")) {
        actionBar.setTitle(spannableString.toString());
    } else {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            actionBar.setTitle(spannableString);
        }
    }
}
 
Example 6
Source File: SettingsActivity.java    From currency with GNU General Public License v3.0 5 votes vote down vote up
@Override
@SuppressWarnings("deprecation")
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    // Get preferences
    SharedPreferences preferences =
        PreferenceManager.getDefaultSharedPreferences(this);

    boolean dark =
        preferences.getBoolean(Main.PREF_DARK, true);

    if (!dark)
        setTheme(R.style.AppLightTheme);

    // Display the fragment as the main content.
    getFragmentManager().beginTransaction()
    .replace(android.R.id.content, new SettingsFragment())
    .commit();

    // Enable back navigation on action bar
    ActionBar actionBar = getActionBar();
    if (actionBar != null)
    {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(R.string.settings);
    }
}
 
Example 7
Source File: DeveloperSettingFragment.java    From VIA-AI with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);
    //view.setBackgroundColor(getResources().getColor(android.R.color.your_color));

    // set name of actionbar.
    ActionBar actionBar = getActivity().getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(getResources().getString(R.string.prefTitle_Developer));
    }
    return view;
}
 
Example 8
Source File: SettingHeaderFragment.java    From VIA-AI with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);
    //view.setBackgroundColor(getResources().getColor(android.R.color.your_color));
    //view.setBackgroundColor(getResources().getColor(R.color.prefBkg_System));

    // set name of actionbar.
    ActionBar actionBar = getActivity().getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(getResources().getString(R.string.prefTitle_System));
    }
    return view;
}
 
Example 9
Source File: PrefFragment.java    From catnut with MIT License 5 votes vote down vote up
@Override
public void onStart() {
	super.onStart();
	ActionBar bar = getActivity().getActionBar();
	bar.setTitle(getText(R.string.pref));
	bar.setIcon(R.drawable.ic_title_pref);
}
 
Example 10
Source File: FaBoServiceListActivity.java    From DeviceConnect-Android with MIT License 5 votes vote down vote up
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_service_list);

    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_HOME);
        actionBar.setTitle(R.string.activity_service_list_title);
    }

    bindMessageService();
}
 
Example 11
Source File: HomeFragment.java    From CameraV with GNU General Public License v3.0 5 votes vote down vote up
private void initHomeActionBar ()
{
	if (getActivity() != null)
	{
		ActionBar actionBar = getActivity().getActionBar();
		actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
		actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME|ActionBar.DISPLAY_SHOW_TITLE);
		actionBar.setTitle(R.string.app_name);			
		actionBar.setDisplayHomeAsUpEnabled(false);
		actionBar.setIcon(R.mipmap.ic_launcher);
		
	}
}
 
Example 12
Source File: DraftFragment.java    From catnut with MIT License 5 votes vote down vote up
@Override
public void onStart() {
	super.onStart();
	ActionBar actionBar = getActivity().getActionBar();
	actionBar.setIcon(R.drawable.ic_title_list);
	actionBar.setTitle(getString(R.string.my_drafts));
}
 
Example 13
Source File: SelectableAdapter.java    From LaunchEnr with GNU General Public License v3.0 5 votes vote down vote up
void toggleSelection(ActionBar actionBar, int position, String packageName) {

        if (mSelections.contains(packageName)) {

            mSelections.remove(packageName);
        } else {
            mSelections.add(packageName);
        }
        if (!mSelections.isEmpty()) {
            actionBar.setTitle(String.valueOf(mSelections.size()) + mContext.getString(R.string.hide_app_selected));
        } else {
            actionBar.setTitle(mContext.getString(R.string.hidden_app));
        }
        notifyItemChanged(position);
    }
 
Example 14
Source File: NavigationDrawerFragment.java    From Alexei with Apache License 2.0 4 votes vote down vote up
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}
 
Example 15
Source File: SettingsActivity.java    From mosmetro-android with GNU General Public License v3.0 4 votes vote down vote up
protected void setTitle(String title) {
    ActionBar bar = getActivity().getActionBar();
    if (bar != null) bar.setTitle(title);
}
 
Example 16
Source File: MainActivity.java    From AndroidCharts with MIT License 4 votes vote down vote up
public void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}
 
Example 17
Source File: MainActivity.java    From chromium-webview-samples with Apache License 2.0 4 votes vote down vote up
public void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}
 
Example 18
Source File: NextBaseFragment.java    From Android-Next with Apache License 2.0 4 votes vote down vote up
public final void setActionBarTitle(CharSequence text) {
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setTitle(text);
    }
}
 
Example 19
Source File: NextBaseFragment.java    From Android-Next with Apache License 2.0 4 votes vote down vote up
public final void setActionBarTitle(int resId) {
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setTitle(resId);
    }
}