Example usage for android.view KeyEvent KEYCODE_ZOOM_IN

List of usage examples for android.view KeyEvent KEYCODE_ZOOM_IN

Introduction

In this page you can find the example usage for android.view KeyEvent KEYCODE_ZOOM_IN.

Prototype

int KEYCODE_ZOOM_IN

To view the source code for android.view KeyEvent KEYCODE_ZOOM_IN.

Click Source Link

Document

Key code constant: Zoom in key.

Usage

From source file:com.softanalle.scma.MainActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    logger.debug("onKeyDown(keyCode=" + keyCode + ")");
    switch (keyCode) {
    case KeyEvent.KEYCODE_BACK: {
        //Handle the back button
        //if(keyCode == KeyEvent.KEYCODE_BACK) {
        //Ask the user if they want to quit
        new AlertDialog.Builder(this).setIcon(R.drawable.ic_dialog_alert).setTitle("Exit?")
                .setMessage("You are about to exit the Application. " + "Do you really want to exit?")
                .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                    @Override//from  www.  ja  v  a  2  s . c  om
                    public void onClick(DialogInterface dialog, int which) {
                        //Stop the activity
                        //maintenancetabs.this.finish();
                        int pid = android.os.Process.myPid();
                        android.os.Process.killProcess(pid);
                    }
                }).setNegativeButton("No", null).show();
        return true;
    }

    // eat zoom -events
    case KeyEvent.KEYCODE_ZOOM_IN: {
        return true;
    }
    case KeyEvent.KEYCODE_ZOOM_OUT: {
        return true;
    }
    }
    return super.onKeyDown(keyCode, event);
}