/** * captures the current bitmap. Calls the save Async task and then loads the new bitmap. * * @param rootview */ private void dispatchDisplayNextImage(View rootview) { if (images != null && !images.isEmpty()) { Image image = images.get(0); if (LABEL_VIEW_TRUE) { toggleLableView(rootview); } drawView.setDrawingCacheEnabled(true); Bitmap bMap = drawView.getDrawingCache(true).copy(Bitmap.Config.RGB_565, false); drawView.destroyDrawingCache(); image.setQuestionComments(commentsEnter.getText().toString()); image.setGrade((float) GRADE); image.setGradeActual((float) GRADEACTUAL); Student student = new Student(); student.setStatus(2); student.setStudentID(ASUAD); new SaveGradedImage(getBaseContext(), student).execute(image, bMap, label, Weights); images.remove(0); if (!images.isEmpty()) { imageLocation = images.get(0).getLocation(); QR_CODE_QUESTION = images.get(0).getQrCodeSolution(); LABEL_VIEW_TRUE = false; Log.d(TAG, "dispatchDisplayNextImage: changing label view to " + false); if (generateQuestionWeights(rootview)) { new ShowNewGradableImage(this, drawView).execute(imageLocation); } else finish(); } else { imageLocation = null; new StudentDao(this).updateStatus(SelectedClass.getInstance().getCurrentClass(), student); Toast.makeText( getBaseContext(), "Image Saved. No more gradable images available", Toast.LENGTH_SHORT) .show(); this.finish(); } dispatchGenerateGrade(); } }