 <p>Assign to learningTime the System.currentTimeMillis() value so it's 0 > 3000</p> <pre><code>learningTime = System.currentTimeMillis() </code></pre> <p>And, anyway you will block the main thread with this code. </p> <p>That can be an example of Handler</p> <pre><code>final Handler handler = new Handler(); Runnable runnable = new Runnable() { @Override public void run() { handler.postDelayed(this, 3000); } }; handler.postDelayed(runnable, 3000); </code></pre> <p><a href="http://developer.android.com/reference/android/os/Handler.html" rel="nofollow"><code>Handler class</code></a> <a href="http://developer.android.com/reference/java/lang/Runnable.html" rel="nofollow"><code>Runnable</code></a> <a href="http://developer.android.com/reference/android/os/Handler.html#postDelayed%28java.lang.Runnable,%20long%29" rel="nofollow"><code>Handler postDelayed</code></a></p> <p>Anyway, you don't need anymore <code>learningTime</code> and <code>i</code> (?)</p>