Replay - Custom Touch Capture

While all standard Android widgets are captured by default, some custom views may need additional configuration in order to perform correctly. Here are workarounds for the types of custom views known to cause issues with Replay:

Custom views that are not identified as touch-enabled

The touch capture system attempts to identify touch-enabled views and listen to their touches automatically, but custom views can sometimes be missed in this automated process. In these cases, the client should mark the view for special attention by using the ‘@CustomView’ annotation before the view’s class definition, as below:

public class YourCustomView {
	// Your class definition

Custom views that implement their own OnTouchListeners

Replay uses the ‘onTouchListener’ framework to capture touches. Due to the limitations of the Android platform, there can be only one ‘onTouchListener’ per view. If the client’s custom view implements its own ‘onTouchListener’, it does not work with Replay enabled since the listener is replaced during the capture process. In these cases, there are two options:

  1. Instruct Replay to ignore all touches from the view by adding the annotation ‘@IgnoreTouches’ before the view’s class definition:
    public class YourCustomView {
        // Your class definition
  2. Allow Replay to capture touches by implementing the ForeSee version of an OnTouchListener which enables more than one touch listener per view. To do this, add the original ‘onTouchListener’ and ForeSee’s ‘BroadcastTouchListener’ as member variables and also override the setOntouchListener() method of the view as follows:
    public class YourCustomView extends YourBaseView {
        // Add the member variables
        private final OnTouchListener yourOriginalTouchListener;
        private BroadcastTouchListener fsTouchListener;
        public YourCustomView() {
            // Your constructor code
            yourOriginalTouchListener = new OnTouchListener {
                // Your original touch listener code
            // Call the overriden setOnTouchListener function
        public void setOnTouchListener(OnTouchListener l) {
            if(fsTouchListener==null) {
                fsTouchListener = new BroadcastTouchListener();
            fsTouchListener.addOnTouchListener(new WeakReference<OnTouchListener>(l));
        // Other client functions

Other articles in this section:

  1. Replay Overview
  2. Sessions
  3. Paging
  4. Masking
  5. Performance
  6. Limitations
  7. Custom Touch Capture (current article)
  8. Custom Image Capture
  9. Performance Techniques
  10. Remote Disable