Example usage for android.view KeyEvent KEYCODE_ZOOM_OUT

List of usage examples for android.view KeyEvent KEYCODE_ZOOM_OUT

Introduction

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

Prototype

int KEYCODE_ZOOM_OUT

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

Click Source Link

Document

Key code constant: Zoom out 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 w  w  w  .  j a va2 s.  c  o m*/
                    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);
}