@Override
  protected Boolean doInBackground(String... arg0) {
    translatedText = Translator.translate(activity, sourceLanguageCode, targetLanguageCode, sourceText);

    // Check for failed translations.
    if (translatedText.equals(Translator.BAD_TRANSLATION_MSG)) {
      return false;
    }
    
    return true;
  }
Class to perform translations in the background.
OCRTest/src/main/java/edu/sfsu/cs/orange/ocr/language/TranslateAsyncTask.java