---
title: "How to invoke the search UI in the PdfActivity programmatically"
canonical_url: "https://www.nutrient.io/guides/android/knowledge-base/invoke-search-programmatically/"
md_url: "https://www.nutrient.io/guides/android/knowledge-base/invoke-search-programmatically.md"
last_updated: "2026-06-26T03:15:47.233Z"
description: "If you want to show the search view and/or start search in the search view, you can use the following method in PdfActivity. for Nutrient Android SDK."
---

If you want to show the search view and/or start search in the search view, you can use the following method in [`PdfActivity`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-activity/index.html).

You’ll need to register the `PSPDFView`’s visibility change listener to begin searching immediately after the search view is shown:

```kt

pspdfKitViews.addOnVisibilityChangedListener(object : OnVisibilityChangedListener {
    override fun onShow(view: View) {
        if (view is PdfSearchViewInline) {
            view.setInputFieldText("query", true)
        } else if (view is PdfSearchViewModular) {
            view.setInputFieldText("query", true)
        }
        pspdfKitViews.removeOnVisibilityChangedListener(this)
    }

    override fun onHide(view: View) {
    }
})

```

You can then show the search view via the following:

```kt

pspdfKitViews.showView(PSPDFKitViews.Type.VIEW_SEARCH)

```

If you want to invoke search programmatically, or if you want to build a custom search user interface (UI), refer to our [text search](https://www.nutrient.io/guides/android/features/text-search.md) guide, which explains all the aspects of search and how to integrate it into your UI.
---

## Related pages

- [Allow Clear Text Traffic](/guides/android/knowledge-base/allow-clear-text-traffic.md)
- [Custom Print Functionality](/guides/android/knowledge-base/custom-print-functionality.md)
- [Deleting Pages From A Pdf](/guides/android/knowledge-base/deleting-pages-from-a-pdf.md)
- [Compose Qna](/guides/android/knowledge-base/compose-qna.md)
- [Easily disable share and print options in Android](/guides/android/knowledge-base/disable-share-documentinfo-print.md)
- [Disabling Annotation Rotation](/guides/android/knowledge-base/disabling-annotation-rotation.md)
- [Change page layout dynamically based on orientation](/guides/android/knowledge-base/dynamic-page-layout-when-changing-orientation.md)
- [Managing touch scrolling in Compose containers](/guides/android/knowledge-base/document-view-inside-pager-scroll-handling.md)
- [Getting All Digital Signatures](/guides/android/knowledge-base/getting-all-digital-signatures.md)
- [Intercepting Touch Events](/guides/android/knowledge-base/intercepting-touch-events.md)
- [Getting Signature Location](/guides/android/knowledge-base/getting-signature-location.md)
- [Install Failed Insufficient Storage](/guides/android/knowledge-base/install-failed-insufficient-storage.md)
- [Invoking Share Action Programmatically](/guides/android/knowledge-base/invoking-share-action-programmatically.md)
- [Creating invisible digital signatures in Android](/guides/android/knowledge-base/invisible-signature.md)
- [Override Hyperlink Behavior](/guides/android/knowledge-base/override-hyperlink-behavior.md)
- [Making Form Elements Read Only](/guides/android/knowledge-base/making-form-elements-read-only.md)
- [Runtime Permissions Cordova](/guides/android/knowledge-base/runtime-permissions-cordova.md)
- [Customize the overflow button color in Android](/guides/android/knowledge-base/styling-overflow-button.md)
- [Remove Tool Variant From Toolbar](/guides/android/knowledge-base/remove-tool-variant-from-toolbar.md)
- [Save signed PDFs directly to a remote server on Android](/guides/android/knowledge-base/save-signed-pdfs-to-remote-server.md)
- [Using Pspdfkit With Dynamic Feature Modules](/guides/android/knowledge-base/using-pspdfkit-with-dynamic-feature-modules.md)

