Code example for KeyEvent

Methods: isCanceledisTracking

0
        return super.onKeyDown(keyCode, event);
    } 
 
    @Override 
    public boolean onKeyUp(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking()
                && !event.isCanceled()) {
            if (getScale() > 1.0f) { 
                // If we're zoomed in, pressing Back jumps out to show the 
                // entire image, otherwise Back returns the user to the gallery. 
                zoomTo(1.0f); 
                return true; 
            } 
        } 
        return super.onKeyUp(keyCode, event);
    } 
 
    protected Handler mHandler = new Handler();
 
    @Override 
    public void setImageBitmap(Bitmap bitmap) {