Code example for Queue

Methods: peek, remove, size

0
     
    // Executed in the background. 
    private final Runnable mTaskWorker = new Runnable() {
      @Override 
      public void run() { 
	String task = mTaskQueue.peek(); 
        try { 
          if (mTaskHolder != null && mTaskHolder.get() != null) { 
            mTaskQueue.remove(); 
            mTaskHolder = null; 
            // Post processing. 
            if (mTaskQueue.size() == 0) { 
              // We're done here. 
               
              return; 
            } else if (mMainThreadHandler != null) { 
              // There's still some work to do. 
              mMainThreadHandler.post(mTaskStarter); 
              return; 
            } 
          }