taking a picture with onTouch on X seconds
<p>First of all I want to Thank SO for being here for the don`t Know hows.
Second, I am relative new to android programing and doing this for about 2 weeks now.</p>

<p>ok My Question:</p>

<p>I`m Writing an app where you have to ttake a picture when you tap on the screen.
I managed to do that, but in a later stage of the app you can scroll through more then 1 canvas in the live camera view.
So the picture must not be taking when you tap ones on the screen, but when you touch and hold the screen after an X amount of seconds it must take the pucture.</p>

<p>so that if you are scrolling through the canvases you dont take the picture on the moment you hit the screen.</p>

<p>if tried to register the current time on the <code>ACTION_DOWN</code> event and compare it with the current time + 5000 (miliseconds) 
are there any sugestions on how to achieve this ?</p>

<p>Kind Regards</p>

<p><code>
     public boolean onTouchEvent(MotionEvent event)
        {
         if(event.getAction() == MotionEvent.ACTION_DOWN)
        {
            long activateTime = System.currentTimeMillis();</p>

<pre><code>if(event.getAction() == MotionEvent.ACTION_DOWN &amp;&amp; activateTime + 5000 == System.currentTimeMillis())
    {
        takePicture();
    }
}
return false;
};
</code></pre>

<p></code></p>

<p>EDIT!
this source code was the key for me.</p>

<p><code></p>

<pre>public class GestureDemo extends Activity implements OnGestureListener {

private GestureDetector gestureDetector;

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

gestureDetector = new GestureDetector(this);

}

@Override

public boolean onTouchEvent(MotionEvent event) {

return gestureDetector.onTouchEvent(event);

}

@Override

public boolean onDown(MotionEvent e) {

Toast.makeText(this,"oNDown called",Toast.LENGTH_SHORT).show();

return false;

}

@Override

public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,

float velocityY) {

Toast.makeText(this,"oNFling called",Toast.LENGTH_SHORT).show();
return false;

}

@Override

public void onLongPress(MotionEvent e) {

Toast.makeText(this,"OnLongPress called",Toast.LENGTH_SHORT).show();

}

@Override

public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,

float distanceY) {

Toast.makeText(this,"onScroll called",Toast.LENGTH_SHORT).show();

return false;

}

@Override
public void onShowPress(MotionEvent e) {

Toast.makeText(this,"onShowPress called",Toast.LENGTH_SHORT).show();

}

@Override

public boolean onSingleTapUp(MotionEvent e) {

Toast.makeText(this,"oNsingleTap called",Toast.LENGTH_SHORT).show();

return false;
}

&lt;/code&gt;
</code></pre>

<p>heres the link where I found the <a href="http://www.androidpeople.com/android-gesture-handling" rel="nofollow">code</a>!</p>

<p>Thank you will for pointing me in the right deriction.</p>
