Rate This Document
Findability
Accuracy
Completeness
Readability

Associating the Touch Engine with SurfaceView

Application Scenario

Associate the touch engine with the SurfaceView control to transfer touch data.

Prerequisites

  • The video stream engine has been initialized successfully.
  • The SurfaceView control has been initialized.
  • The SurfaceView control has been set to a fixed size.

Development Process

Call the onTouch method of the touch engine within MotionEvent of SurfaceView.

Encoding Instance

public class Activity implements BaseActivity {
    surfaceView.setOnTouchListener(new View.onTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent event) {
            // Associate the touch engine with View.
            return VmiTouch.getInstance().onTouch(view, event);
        }
    });
}