Example usage for android.view SurfaceView setOnKeyListener

List of usage examples for android.view SurfaceView setOnKeyListener

Introduction

In this page you can find the example usage for android.view SurfaceView setOnKeyListener.

Prototype

public void setOnKeyListener(OnKeyListener l) 

Source Link

Document

Register a callback to be invoked when a hardware key is pressed in this view.

Usage

From source file:ch.jeda.platform.android.CanvasFragment.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    final SurfaceView result = new SurfaceView(this.getActivity());
    result.setFocusable(true);//from www. ja  v a  2s  .com
    result.setFocusableInTouchMode(true);
    result.setOnKeyListener(this);
    result.setOnTouchListener(this);
    this.surfaceHolder = result.getHolder();
    this.surfaceHolder.addCallback(this);
    return result;
}