Code example for View

Methods: setOnGenericMotionListener

1
		super(activity, context, view, config);
		// we hook into View, for LWPs we call onTouch below directly from 
		// within the AndroidLivewallpaperEngine#onTouchEvent() method. 
		if (view instanceof View) {
			View v = (View)view;
			v.setOnGenericMotionListener(this);
		} 
	} 
	 
	@Override 
	public boolean onGenericMotion (View view, MotionEvent event) {
		for (int i = 0, n = genericMotionListeners.size(); i < n; i++)
			if (genericMotionListeners.get(i).onGenericMotion(view, event)) return true;
		return false; 
	} 
	 
	public void addGenericMotionListener (OnGenericMotionListener listener) {
		genericMotionListeners.add(listener);
	} 
}