@Override
  public boolean onContextItemSelected(MenuItem item) {
    ClipboardManager clipboardManager = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
    switch (item.getItemId()) {

    case OPTIONS_COPY_RECOGNIZED_TEXT_ID:
        clipboardManager.setText(ocrResultView.getText());
      if (clipboardManager.hasText()) {
        Toast toast = Toast.makeText(this, "Text copied.", Toast.LENGTH_LONG);
        toast.setGravity(Gravity.BOTTOM, 0, 0);
        toast.show();
      }
      return true;
    case OPTIONS_SHARE_RECOGNIZED_TEXT_ID:
    	Intent shareRecognizedTextIntent = new Intent(android.content.Intent.ACTION_SEND);
    	shareRecognizedTextIntent.setType("text/plain");
    	shareRecognizedTextIntent.putExtra(android.content.Intent.EXTRA_TEXT, ocrResultView.getText());
    	startActivity(Intent.createChooser(shareRecognizedTextIntent, "Share via"));
    	return true;
    case OPTIONS_COPY_TRANSLATED_TEXT_ID:
        clipboardManager.setText(translationView.getText());
      if (clipboardManager.hasText()) {
        Toast toast = Toast.makeText(this, "Text copied.", Toast.LENGTH_LONG);
        toast.setGravity(Gravity.BOTTOM, 0, 0);
        toast.show();
      }
      return true;
    case OPTIONS_SHARE_TRANSLATED_TEXT_ID:
    	Intent shareTranslatedTextIntent = new Intent(android.content.Intent.ACTION_SEND);
    	shareTranslatedTextIntent.setType("text/plain");
    	shareTranslatedTextIntent.putExtra(android.content.Intent.EXTRA_TEXT, translationView.getText());
    	startActivity(Intent.createChooser(shareTranslatedTextIntent, "Share via"));
    	return true;
    default:
      return super.onContextItemSelected(item);
    }
  }
Given either a Spannable String or a regular String and a token, apply
the given CharacterStyle to the span between the tokens.

NOTE: This method was adapted from:
 http://www.androidengineer.com/2010/08/easy-method-for-formatting-android.html

<p>
For example, {@code setSpanBetweenTokens("Hello ##world##!", "##", new
ForegroundColorSpan(0xFFFF0000));} will return a CharSequence {@code
"Hello world!"} with {@code world} in red.
OCRTest/src/main/java/edu/sfsu/cs/orange/ocr/CaptureActivity.java