private void uploadNextPost() {
   synchronized (mPostsList) {
     if (mCurrentTask == null) { // make sure nothing is running
       mCurrentUploadingPost = null;
       if (mPostsList.size() > 0) {
         mCurrentUploadingPost = mPostsList.remove(0);
         mCurrentTask = new UploadPostTask();
         mCurrentTask.execute(mCurrentUploadingPost);
       } else {
         stopSelf();
       }
     }
   }
 }
 private void uploadNextPost() {
   synchronized (listOfPosts) {
     if (currentTask == null) { // make sure nothing is running
       currentUploadingPost = null;
       if (listOfPosts.size() > 0) {
         currentUploadingPost = listOfPosts.remove(0);
         currentTask = new UploadPostTask();
         currentTask.execute(currentUploadingPost);
       } else {
         this.stopSelf();
       }
     }
   }
 }