moving player right or left depending on swipe
I changed some local variables and make them static variables, why ? because these are created and destroyed if you use serveral times the method onFling. The main Idea is to improve the performance and decrease the space your method uses.

Also I refactorized some pieces of code 

class MyGestureDetector extends SimpleOnGestureListener {
        private static DateFormat date = new SimpleDateFormat("KK:mm");
        private static Calendar cal;        

        MyGestureDetector() {
            date.setTimeZone(TimeZone.getTimeZone("GMT-4:00"));
        }

        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
            cal = Calendar.getInstance(TimeZone.getTimeZone("GMT-4:00"));
            String localTime = date.format(cal.getTime());
            try {
                if (Math.abs(e1.getY() - e2.getY()) &gt; SWIPE_MAX_OFF_PATH)
                    return false;
                // right to left swipe
                if(e1.getX() - e2.getX() &gt; SWIPE_MIN_DISTANCE &amp;&amp; Math.abs(velocityX) &gt; SWIPE_THRESHOLD_VELOCITY) {
                    X -= K;
                    Y *= Math.cos(18*cal.get(Calendar.SECOND)); //18 * currentSeconds i think
                } else if (e2.getX() - e1.getX() &gt; SWIPE_MIN_DISTANCE &amp;&amp; Math.abs(velocityX) &gt; SWIPE_THRESHOLD_VELOCITY) {
                    X += K;
                    Y *= Math.cos(18*cal.get(Calendar.SECOND));
                }
            } catch (Exception e) {
                // Perhaps if the program does nothing or have an unexpected behavior
                // you are silencing the cause (it has happened to me)
                e.printStackTrace();
            }
            return false;
        }


Hope it helped.