How To Detect No Touch On A View After Some Seconds?
I have a small view (call it 'user-object') which overlap the background view (call it map). I can drag the 'user-object'. I want the 'user-object' automatically move to 'mid-poin
Solution 1:
You can send a delay(3000ms) message at the beging and move "user-object" in the Handler's callback,If "user-object" was touched,remove the message
Solution 2:
An example using Handler
Handler mHandler;
public void useHandler() {
mHandler = new Handler();
mHandler.postDelayed(mRunnable, 1000);
}
private Runnable mRunnable = new Runnable() {
@Override
public void run() {
// Perform this here
"user-object" automatically move to "mid-point" (screen_width/2, screen_height/2)
mHandler.postDelayed(mRunnable, 1000);
}
After a drag/touch event is triggered, again apply handler.postDelayed()
.
Post a Comment for "How To Detect No Touch On A View After Some Seconds?"