Skip to content Skip to sidebar Skip to footer

Why Is My Simpleongesturelistener Not Functioning?

I'm using my own GestureDetector class to detect a left|right onFling event. Everything I see looks good in my code but nothing happens...? I need the added functionality beyond

Solution 1:

I think one reason is that Gesture work on onFling that condition not satisfied in u r code i have implemented one OntouchListener try this

yourView.setOnTouchListner(onThumbTouch );




    OnTouchListener onThumbTouch = new OnTouchListener()
        {
            float previouspoint = 0 ;
            float startPoint=0;
            @Override
            public boolean onTouch(View v, MotionEvent event) 
            {   
                switch(v.getId())
                {
                case R.id.tvDetailsalaujairiyat: // Give your R.id.sample ...
                {
                    switch(event.getAction())
                    {
                    case MotionEvent.ACTION_DOWN:
                    {          
                        startPoint=event.getX();
                        System.out.println("Action down,..."+event.getX());
                    }
                    break;
                    case MotionEvent.ACTION_MOVE:
                    {       

                    }break;
                    case MotionEvent.ACTION_CANCEL:
                    {                           

                        previouspoint=event.getX();
                        if(previouspoint > startPoint){
                            //Right side swape

                        }else{
                        // Left side swape
                        }

                    }break;

                    }
                    break;
                }
                }
                return true;
            }
        };

Post a Comment for "Why Is My Simpleongesturelistener Not Functioning?"