Source:
<code>protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); if (requestCode == FORM_PREFERENCES_KEY) { refreshCurrentView(false); return; } if (resultCode == RESULT_CANCELED) { if (requestCode == HIERARCHY_ACTIVITY_FIRST_START) { finishReturnInstance(false); } else if (requestCode == INTENT_CALLOUT){ processIntentResponse(intent, true); } return; } switch (requestCode) { case BARCODE_CAPTURE: String sb = intent.getStringExtra("SCAN_RESULT"); questionsView.setBinaryData(sb, mFormController); saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); break; case INTENT_CALLOUT: processIntentResponse(intent); break; case IMAGE_CAPTURE: ImageCaptureProcessing.processCaptureResponse(this, getInstanceFolder(), true); break; case SIGNATURE_CAPTURE: boolean saved = ImageCaptureProcessing.processCaptureResponse(this, getInstanceFolder(), false); if (saved) { ImageButton nextButton = (ImageButton)this.findViewById(R.id.nav_btn_next); <START> if (nextButton.getTag().equals(NAV_STATE_NEXT) && !questionsView.isQuestionList()) { <END> next(); } } break; case IMAGE_CHOOSER: ImageCaptureProcessing.processImageChooserResponse(this, getInstanceFolder(), intent); break; case AUDIO_VIDEO_FETCH: processChooserResponse(intent); break; case LOCATION_CAPTURE: String sl = intent.getStringExtra(LOCATION_RESULT); questionsView.setBinaryData(sl, mFormController); saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); break; case HIERARCHY_ACTIVITY: case HIERARCHY_ACTIVITY_FIRST_START: if (resultCode == FormHierarchyActivity.RESULT_XPATH_ERROR) { finish(); } else { refreshCurrentView(false); } break; } }</code><technical_language>nextButton.getTag().equals(NAV_STATE_NEXT) is pretty 'low-level' code, good lift a named helper method in onForwardSwipe, line of code</technical_language>

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); if (requestCode == FORM_PREFERENCES_KEY) { refreshCurrentView(false); return; } if (resultCode == RESULT_CANCELED) { if (requestCode == HIERARCHY_ACTIVITY_FIRST_START) { finishReturnInstance(false); } else if (requestCode == INTENT_CALLOUT){ processIntentResponse(intent, true); } return; } switch (requestCode) { case BARCODE_CAPTURE: String sb = intent.getStringExtra("SCAN_RESULT"); questionsView.setBinaryData(sb, mFormController); saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); break; case INTENT_CALLOUT: processIntentResponse(intent); break; case IMAGE_CAPTURE: ImageCaptureProcessing.processCaptureResponse(this, getInstanceFolder(), true); break; case SIGNATURE_CAPTURE: boolean saved = ImageCaptureProcessing.processCaptureResponse(this, getInstanceFolder(), false); if (saved) { advance(); } break; case IMAGE_CHOOSER: ImageCaptureProcessing.processImageChooserResponse(this, getInstanceFolder(), intent); break; case AUDIO_VIDEO_FETCH: processChooserResponse(intent); break; case LOCATION_CAPTURE: String sl = intent.getStringExtra(LOCATION_RESULT); questionsView.setBinaryData(sl, mFormController); saveAnswersForCurrentScreen(DO_NOT_EVALUATE_CONSTRAINTS); break; case HIERARCHY_ACTIVITY: case HIERARCHY_ACTIVITY_FIRST_START: if (resultCode == FormHierarchyActivity.RESULT_XPATH_ERROR) { finish(); } else { refreshCurrentView(false); } break; } }