set ActionBar Title and check sdk version - Android User Interface

Android examples for User Interface:ActionBar Title

Description

set ActionBar Title and check sdk version

Demo Code


//package com.java2s;
import android.app.ActionBar;
import android.app.Activity;
import android.os.Build;

public class Main {
    public static void setTitle(Activity activity, String title) {
        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) {
            ActionBar actionBar = activity.getActionBar();
            //noinspection ConstantConditions
            actionBar.setTitle(title);//from w w  w . j av a 2 s . c o  m
        }
    }
}

Related Tutorials