Skip to content

Android View onTouchListener

OnTouchListener not working ?

If your app is not registering touch events once the Pointzi SDK has been integrated, it may be because the OntouchListener is not working. As Android only allows one OnTouchListener, please follow the steps below to ensure the apps native OntouchListener and the Pointzi OntouchListener are working properly.

//Get the instance of our SDK :
// if PZ is greater than 1.6.3 use 
PZCompositeOnClickListener instance =  PZCompositeOnClickListener.getInstance();

// if lower then use 
SHCompositeOnClickListener instance =  SHCompositeOnClickListener.getInstance();

//Add your own OnTouchListener Class and your View: 
instance.addOnClickListener(new MyOnTouchListener(), myView);
//Set OnTouchListener to our instance :
myView.setOnTouchListener(instance);

Enable/Disable Pointzi OnTouchListener

Available for Pointzi Version equal to or greater than 1.6.3, you can also enable or disable Pointzi OnTouchListener. In the following function by passing true it will enable/re-enable the Pointzi OnTouchListener, and a false value will completely disable the feature.

 PZCompositeOnClickListener.getInstance().enablePZOnTouchListener(
     <Activity>,
     <Boolean>
 );

Still having trouble? See our Source code

Explanation

Pointzi uses the OnTouchListener to capture events in your app. These events - including page views or touch events - can then be used in experiments as filters. For example, to target users the third time they enter a view, the OnTouchListener would be required to capture the number of times a user has entered a screen view before that time.