check Device Has Navigation Bar - Android User Interface

Android examples for User Interface:NavigationBar

Description

check Device Has Navigation Bar

Demo Code


//package com.java2s;
import android.annotation.TargetApi;

import android.content.Context;

import android.os.Build;

import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.ViewConfiguration;

public class Main {

    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    //API 14//from  w  w w  .  jav a2 s  .c  o  m
    public static boolean checkDeviceHasNavigationBar(Context context) {
        boolean hasMenuKey = ViewConfiguration.get(context)
                .hasPermanentMenuKey();
        boolean hasBackKey = KeyCharacterMap
                .deviceHasKey(KeyEvent.KEYCODE_BACK);

        if (!hasBackKey) {
            return true;
        }

        return false;
    }
}

Related Tutorials