Android The constructor GestureDetector(GestureDetector.OnGestureListener) is deprecated

定义GestureDetector时会提示构造器已经弃用要加上忽视警告语句:@SuppressWarnings("deprecation")  GestureDetector会被划上条横线代表此语句已经过时

修改:

随着Android SDK升级前某些接口能有更好、更安全接口来代替Android开发团队会把过时接口标识成deprecated, 开发文档提示使用新代替接口用GestureDetector构造函数4.1版本已经过时使用推荐:
mGestureDetector = new GestureDetector(this, this);
// 注意前this代表Context,this代表OnGestureListener
// Activity继承自Context, 而activity应该实现了(implements)OnGestureListener接口

你可能感兴趣的:(android)