You can instead use the MotionEvent
object directly to achieve the same.
Please see the example & comparison as below:
public boolean onTouch(MotionEvent motionEvent) {
// previously you would do this
final int action = MotionEventCompat.getActionMasked();
// now you would do this
final int action = motionEvent.getActionMasked();
}
I think you are confused, as some of the Android documentation has yet to update their sample code, so some of their sample code is still using the deprecated methods.
For more info, please read here.
Hope this helps.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…