I wrapped my graph in a linear layout:
<LinearLayout
android:id="@+id/graphLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.androidplot.xy.XYPlot
android:id="@+id/mySimpleXYPlot"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
....
Then in the .java file I assigned the view to the linear layout and set the onTouchListener to that layout:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_graph);
LinearLayout view = (LinearLayout) findViewById(R.id.graphLayout); // assign layout graph is in
view.setOnTouchListener(this); // set onTouchListener to graph's layout
plot = (XYPlot) findViewById(R.id.mySimpleXYPlot);
....
That worked for me.