Code example for CountDownLatch

Methods: countDown

0
      activity.runOnUiThread(new Runnable() {
        @Override public void run() { 
          try { 
            drawDecorViewToBitmap(activity, bitmap);
          } finally { 
            latch.countDown();
          } 
        } 
      }); 
      try { 
        latch.await();
      } catch (InterruptedException e) {
        String msg = "Unable to get screenshot " + file.getAbsolutePath();
        Log.e(TAG, msg, e);
        throw new RuntimeException(msg, e);
      } 
    } 
 
    OutputStream fos = null;
    try { 
      fos = new BufferedOutputStream(new FileOutputStream(file));