Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.view.Window;
import android.view.WindowManager;

public class Main {
    /**
     * force show virtual menu key </br>
     * must call after setContentView() 
     * @param window you can use getWindow()
     */
    public static void forceShowMenuKey(Window window) {
        try {
            window.addFlags(WindowManager.LayoutParams.class.getField("FLAG_NEEDS_MENU_KEY").getInt(null));
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        }
    }
}