Example usage for android.view SurfaceView setFocusableInTouchMode

List of usage examples for android.view SurfaceView setFocusableInTouchMode

Introduction

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

Prototype

public void setFocusableInTouchMode(boolean focusableInTouchMode) 

Source Link

Document

Set whether this view can receive focus while in touch mode.

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);/*w w w . j a va 2 s  . c o  m*/
    result.setFocusableInTouchMode(true);
    result.setOnKeyListener(this);
    result.setOnTouchListener(this);
    this.surfaceHolder = result.getHolder();
    this.surfaceHolder.addCallback(this);
    return result;
}