set Home Button Enabled - Android Activity

Android examples for Activity:Activity Action

Description

set Home Button Enabled

Demo Code


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

public class Main {
    public static void setHomeButtonEnabled(boolean homeButtonEnabled,
            Activity activity) {/* w w w  .  j av  a  2  s  . c o  m*/
        /*
        Beginning with Android 4.0 (API level 14), the icon must explicitly be enabled as an action item by calling
        setHomeButtonEnabled(true). In previous versions, the icon was enabled as an action item by default.
         */
        if (Build.VERSION.SDK_INT >= 14) {
            activity.getActionBar().setHomeButtonEnabled(true);
        }
    }
}

Related Tutorials