Class LiveText

java.lang.Object
com.vuzix.ultralite.utils.scroll.LiveText

public class LiveText extends Object

LiveText is a utility class to send small blocks of rapidly updating text to the glasses to be displayed at the bottom of the field of view. This creates an effect similar to closed captioning on a television.

This class efficiently updates the current line of text on the screen by adding new words to the end, and then scrolls the completed lines upwards to make room for new content below.

Earlier lines of text may be edited or removed.

This class does not implement any interfaces to the glasses. This is a convenience class to track state and perform SDK calls to implement a specific behavior. All the functionality provided by this class could be developed using only the public SDK.

This uses the TextToImageSlicer utility class to create the content that is sent to the glasses.

If the content known up front, and not subject to change, and a smooth scrolling is preferred to a line-by-line insertion, consider using AutoScroller instead.

See Also:
  • Constructor Details

    • LiveText

      public LiveText(UltraliteSDK ultraliteSdk, int lineHeight, int lineWidth, android.text.TextPaint textPaint)
      Creates an instance of the LiveText.
      Parameters:
      ultraliteSdk - The instance of your UltraliteSDK.
      lineHeight - The number of glasses pixels each line of text will utilize. This must be large enough to fit a single line of text at the requested font size, plus any inter-line padding that is desired. Range: [30-120] pixels.
      lineWidth - The width of the text on the screen. Range: [1-640]
      textPaint - Specifies all attributes related to text drawing. Send null to use the default TextPaint.
  • Method Details

    • sendText

      public void sendText(String stringToDisplay)

      Start showing the specified text.

      The caller must requestControl() and setLayout(Layout.SCROLL,...) prior to calling this.

      Parameters:
      stringToDisplay - Most recent string of all text that should be on the glasses now
      Throws:
      IllegalStateException - If we do not have control or are not in the scroll layout.
    • clear

      public void clear()

      Clear the glasses display of previously shown text

      The caller must requestControl() and setLayout(Layout.SCROLL,...) prior to calling this.

      Throws:
      IllegalStateException - If we do not have control or are not in the scroll layout.