Associating the Touch Engine with the SurfaceView
Application Scenario
The touch engine needs to be associated with the SurfaceView control to transfer touch data.
Prerequisites
- The instruction stream engine has been initialized.
- 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);
}
});
}
Parent topic: API Development Process