1

I was changing view when click button using Layoutinflater.The button have located in the same position in all the screen. If i click button it change the view only once.If i double click the button it change the view twice.It means click event dispatched twice in two different layouts.Here when i double click the button it should change only once.

For that what should i do?

Thnx,

codewithdk
  • 1,290
  • 1
  • 10
  • 23

1 Answers1

1

You can take diff of two click events, that is store system time of first event in variable ( global scope) and diff it by system time of latest event. Here you need to decide time span between two click events oon the basis of which you consider wether its a double click or not. Say i consider if second click is done within 35 milliseconds of first click event, its a double click. Thus if the time difference above is less than 35 seconds, you can restrict view change Hope this would help u

user1969053
  • 1,750
  • 1
  • 12
  • 12
  • One more thing that i have missed to ask,when i click 4 images in a single view it shows repeated page views it means multiple touch in single view.For that how do disable multi touch? – codewithdk Jan 23 '13 at 07:00
  • Look at my answer here : http://stackoverflow.com/questions/16460644/android-preventing-double-click-on-a-spinner/29628361#29628361 – Kartihkraj Duraisamy Apr 14 '15 at 13:17