code for handler in android
<p>In for loop, there is a method which invokes handler.post(). There exists a log statement inside for loop which prints a log message 16 times (indicates that for loop executed for 16 times). Similarly there is one more Log message inside run(), but unfortunately app printing this log message 300 times (approx), which ideally should print only for 16 times. Can some one guide me to understand the mistake?</p>

<p>code snippet is:</p>

<pre><code>     do
    {
      final Handler handler = new Handler(); 
      System.out.println("KKKKKKKKKKKKKKKKKKKKKKKKKKKK");
      handler.post(new Runnable() {
        @Override public void run() { 
            System.out.println("IIIIIIIIIIIIIIIIIIIIIIIIII");

              // Post again 16ms later.
               boolean booleanHandler= handler.postDelayed(this, 32); 
               System.out.println("******************************"+booleanHandler);
            } });
   }
while(16 times)
</code></pre>

<p>edit: if condition removed</p>
