Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// Use of this source code is governed by a BSD-style license that can be

import android.view.KeyEvent;

public class Main {
    /**
     * Checks whether the given event is any of ENTER or NUMPAD ENTER.
     * @param event Event to be checked.
     * @return Whether the event should be processed as ENTER.
     */
    public static boolean isEnter(KeyEvent event) {
        return isActionUp(event) && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER
                || event.getKeyCode() == KeyEvent.KEYCODE_NUMPAD_ENTER);
    }

    /**
     * Checks whether the given event is an ACTION_UP event.
     * @param event Event to be checked.
     * @return Whether the event is an ACTION_UP event.
     */
    public static boolean isActionUp(KeyEvent event) {
        return event.getAction() == KeyEvent.ACTION_UP;
    }
}