Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Java Android
I need to separate click and double click(for remote control), for example when I touch surface, timers starts, wheh I touch again timer stops and calculates difference between touches in milliseconds. I googled, but found a large and hard code. Please, help..
Posted 6-Feb-13 6:00am
Comments
Richard MacCutchan at 6-Feb-13 12:47pm
   
Why not show what you have done up to now, and explain which parts you are having difficulty with.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Please check this Blog,m that should explain the thingy: http://steve.odyfamily.com/?p=12[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

If you want the easy way to know the time for the client between to double click .
You don't need to start a timer .
Just do like this
you will get what you want.
public class MainActivity extends Activity {
	
	private long fristTime = -1;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		findViewById(R.id.textmain).setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				if(fristTime>0){
					Log.d("Print","double click between frist click to  second click in milliseconds is : "+(System.currentTimeMillis()-fristTime)); 
					fristTime = -1;
				}
				else{
					fristTime = System.currentTimeMillis();
					
				}
			}
		});
	}
 
	
	
	
 
}
----------------------------------------------------------

by the way.
find a job in New York.
I have 3 year Experience about andorid.
And have few Experience about game server
in MS 2005 server C++.
Thanks.
----------------------------------------------------------
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 205
1 Sergey Alexandrovich Kryukov 165
2 jlopez788 109
3 Rob Philpott 100
4 Prakriti Goyal 97
0 OriginalGriff 6,837
1 Sergey Alexandrovich Kryukov 5,589
2 Maciej Los 3,479
3 Peter Leow 3,323
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 7 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100