OnClick ImageView with OnFling ViewFlipper?

I had encountered this problem in the past Maybe you can try to implement single tap by setting an OnTouchListener to ViewFlipper, thus, the ViewFlipper will be the only touch event receiver. Then write the playing sound code in onTouch function. Finally, set onTouch function's return value to false for the sake of keeping the onFling working viewFlipper.

SetOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent e) { // TODO Auto-generated method stub switch(e.getActionMasked()) { case MotionEvent. ACTION_DOWN: //put the playing sound code here. Break; } return false; //means that the listener dosen't consume the event } } ) It's just a simple solution to solve this problem.

If you want to achieve more complicated function such as avoiding sound playing when finger is swiping on the screen to change the view, you have to take more effort to distinguish gestures, e.g. Calculate the time between ACTION_DOWN event and ACTION_UP event and play the sound if it's less than 300ms I hope this will be helpful to you. :).

I had encountered this problem in the past. Maybe you can try to implement single tap by setting an OnTouchListener to ViewFlipper, thus, the ViewFlipper will be the only touch event receiver. Then write the playing sound code in onTouch function.

Finally, set onTouch function's return value to false for the sake of keeping the onFling working. ViewFlipper. SetOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent e) { // TODO Auto-generated method stub switch(e.getActionMasked()) { case MotionEvent.

ACTION_DOWN: //put the playing sound code here. Break; } return false; //means that the listener dosen't consume the event } } ); It's just a simple solution to solve this problem. If you want to achieve more complicated function such as avoiding sound playing when finger is swiping on the screen to change the view, you have to take more effort to distinguish gestures, e.g. Calculate the time between ACTION_DOWN event and ACTION_UP event and play the sound if it's less than 300ms.

I hope this will be helpful to you. :).

Thanks ... works like you said – Tony Jul 1 at 7:31 Managed to distinguish between click and fling by measuring the distance between ACTION_DOWN and ACTION_UP ... thanks again for your help. – Tony Jul 1 at 10:32 You're welcome:) – Chickenrice Jul 1 at 15:52.

I had encountered this problem in the past.

Vf = (ViewFlipper) findViewById(R.id. Var = arrayphrase. LayoutParams lp = new FrameLayout.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions