> For the complete documentation index, see [llms.txt](https://docs.verygoodsecurity.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verygoodsecurity.com/vault/developer-tools/vgs-show/android-sdk/ui-components.md).

# UI Components

## UI Components

Your app's user interface and everything that users can see and interact with.

### VGSTextView

A user interface element that displays any revealed text to the user.

\*\* Check the [Text field guide](https://github.com/verygoodsecurity/docs-content-vault/blob/update-content/vgs-show/android-sdk/text-view/README.md)\*\*

```xml
<com.verygoodsecurity.vgsshow.widget.VGSTextView
    android:id="@+id/infoField"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:contentPath="<CONTENT_PATH>" />
```

### VGSPDFView

User interface element to display a PDF content. `VGSPDFView` depends on open source Android [PdfViewer](https://github.com/verygoodsecurity/AndroidPdfViewer) library and can be used only with it.

\*\* Check the [PDF field guide](https://github.com/verygoodsecurity/docs-content-vault/blob/update-content/vgs-show/android-sdk/pdf-view/README.md)\*\*

```xml
<com.verygoodsecurity.vgsshow.widget.VGSPDFView
    android:id="@+id/pdfField"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:contentPath="<CONTENT_PATH>" />
```

### VGSImageView

User interface element that is designed to display a revealed images to the user.

\*\* Check the [Image field guide](https://github.com/verygoodsecurity/docs-content-vault/blob/update-content/vgs-show/android-sdk/image-view/README.md)\*\*

```xml
<com.verygoodsecurity.vgsshow.widget.VGSImageView
    android:id="@+id/imageField"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:contentPath="<CONTENT_PATH>" />
```

## Advanced Settings

### Getting content from Nested JSON Structure

When you need to show revealed data from a specific json structure you may do it by adding `.` notation to contentPath-string. Each `.` in a `contentPath` represents a new level of nesting. New content path string could be set into `app:contentPath` or `setContentPath` method.

{% tabs %}
{% tab title="XML" %}

```xml
<com.verygoodsecurity.vgsshow.widget.VGSTextView
    android:id="@+id/infoField"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:contentPath="card_data.card_number" />

```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
val infoField = findViewById<VGSTextView>(R.id.infoField)
infoField.setContentPath("card_data.card_number")
    
```

{% endtab %}

{% tab title="Java" %}

```java
VGSTextView infoField = findViewById(R.id.infoField);
infoField.setContentPath("card_data.card_number");

```

{% endtab %}
{% endtabs %}

### Copy text to clipboard

**VGS Show SDK** provides an option for your end-users to copy revealed text to clipboard after request is completed. You can optionally enable or disable this feature for end-users. Also, you may choose format of data that will be copied to clipboard before you give users the option to paste it.

With `CopyTextFormat` class a you can change the format of a text which might be copied:

* **RAW**: A text string without any formatting.
* **FORMATTED**: A text string which is equal to the text from a field. Usually, VGS input fields applies text formatting for better visual inspection.

Use `copyToClipboard` for VGSTextView to copy revealed text.

{% tabs %}
{% tab title="Kotlin" %}

```kotlin
infoField.copyToClipboard(VGSTextView.CopyTextFormat.RAW)

```

{% endtab %}

{% tab title="Java" %}

```java
infoField.copyToClipboard(VGSTextView.CopyTextFormat.RAW);

```

{% endtab %}
{% endtabs %}

With `OnTextCopyListener` a developer can detect when a user copies text.

{% tabs %}
{% tab title="Kotlin" %}

```kotlin
infoField?.addOnCopyTextListener(object : VGSTextView.OnTextCopyListener {
    override fun onTextCopied(view: VGSTextView, format: VGSTextView.CopyTextFormat) {\n
    }
})
    
```

{% endtab %}

{% tab title="Java" %}

```java
infoField.addOnCopyTextListener(new VGSTextView.OnTextCopyListener() {
  @Override
  public void onTextCopied(VGSTextView view, VGSTextView.CopyTextFormat format) {\n
  }
});

```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.verygoodsecurity.com/vault/developer-tools/vgs-show/android-sdk/ui-components.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
