---
title: "Display PDF on Android with PdfActivity | Nutrient SDK"
canonical_url: "https://www.nutrient.io/guides/android/basics/using-activity/"
md_url: "https://www.nutrient.io/guides/android/basics/using-activity.md"
last_updated: "2026-05-23T00:08:18.003Z"
description: "PdfActivity is the most straightforward way of displaying a PDF document with all Nutrient features. PdfActivity extends Android’s AppCompatActivity."
---

# Display PDFs on Android with PdfActivity

[`PdfActivity`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-activity/index.html) is the most straightforward way of displaying a PDF document with all Nutrient features. [`PdfActivity`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-activity/index.html) extends Android’s `AppCompatActivity` and delivers the current Android and Material Design experience.

## PdfActivity features

The activity hosts a [`PdfFragment`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/index.html) for document viewing and editing. It also contains several configurable views:

- Inline search or modular search views ([`PdfSearchViewInline`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui.search/-pdf-search-view-inline/index.html) or [`PdfSearchViewModular`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui.search/-pdf-search-view-modular/index.html), respectively).

- A thumbnail grid with page numbers and labels ([`PdfThumbnailGrid`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-thumbnail-grid/index.html)). This view also integrates the [Document Editor](https://www.nutrient.io/guides/android/features/document-editor.md).

- A thumbnail bar, allowing quick document scrolling ([`PdfThumbnailBar`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-thumbnail-bar/index.html)).

- A document outline list and a list of annotations (both encapsulated inside [`PdfOutlineView`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-outline-view/index.html)).

This guide gives a short introduction on how to get started with [`PdfActivity`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-activity/index.html).

## Setting up the manifest

Before you can launch [`PdfActivity`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-activity/index.html), you need to add it to your `AndroidManifest.xml`:

```xml

<application
    android:largeHeap="true">

    <activity
        android:name="com.pspdfkit.ui.PdfActivity"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar"
        android:windowSoftInputMode="adjustNothing" />

</application>

```

> **⚠️ Warning:** Do not add `android:configChanges` to the `PdfActivity` entry, as it is not needed by Nutrient and may lead to undesired behavior of the document viewer.

Make sure you define the `android:largeHeap="true"` property on your `<application>` tag inside the manifest file. Rendering PDF files can be memory intensive, and this property will ensure your app has enough heap memory allocated in order to avoid hitting an `OutOfMemoryError`.

### Activity theme

Since [`PdfActivity`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-activity/index.html) extends [`AppCompatActivity`](http://developer.android.com/reference/android/support/v7/app/AppCompatActivity.html), you need to define a `Theme.AppCompat`-based theme via the `android:theme` attribute. You can either use a standard theme (e.g. `Theme.AppCompat.Light.NoActionBar`) or use any custom theme your app provides. Check out our [appearance styling](https://www.nutrient.io/guides/android/customizing-the-interface/appearance-styling.md) guide for more information on creating custom themes.

[`PdfActivity`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-activity/index.html) uses a custom toolbar system based on the app-compact [`Toolbar`](https://developer.android.com/reference/android/support/v7/widget/Toolbar.html) widget. Because of this, the used theme has to disable the default action bar. Either use any `Theme.AppCompat.*.NoActionBar` as a parent theme, or disable the action bar manually by adding the following styles to your custom theme:

```xml

<resources>
    <style name="MyCustomTheme">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionModeOverlay">true</item>...
    </style>
</resources>

```

## Launching the activity

Once you have added [`PdfActivity`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-activity/index.html) to your `AndroidManifest.xml`, you can start it by using its static helper methods for simple cases or, better yet, by building an `Intent` using [`PdfActivityIntentBuilder`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-activity-intent-builder/index.html). You can open documents from a wide range of sources, including the local file system, your app’s assets, content providers, and any other custom data source you define.

### Configuring the activity

When launching [`PdfActivity`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-activity/index.html), you need to provide an instance of [`PdfActivityConfiguration`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.configuration.activity/-pdf-activity-configuration/index.html). This configuration object allows you to configure the appearance and features of the activity. To create the configuration, use `PdfActivityConfiguration.Builder`:

### KOTLIN

```kotlin

// This will create the default configuration, or you can use a different builder
// method for configuring the activity.
val config = PdfActivityConfiguration.Builder(context).build()

```

### JAVA

```java

// This will create the default configuration, or you can use a different builder
// method for configuring the activity.
final PdfActivityConfiguration config =
    new PdfActivityConfiguration.Builder(context).build();

```

The above example creates the default activity configuration, but you can use any other configuration as well. The full list of available configuration options can be found in our API reference for [`PdfActivityConfiguration.Builder`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.configuration.activity/-pdf-activity-configuration/-builder/index.html).

### Launching from a URI using the static methods

Using a [`Uri`](http://developer.android.com/reference/android/net/Uri.html), you can open documents from the local device file system, your app’s assets, or a document content provider (using Android’s [Storage Access Framework](https://developer.android.com/guide/topics/providers/document-provider.html)). Use the [`PdfActivity.showDocument()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-activity/show-document.html) call as a convenience for simple use cases:

### KOTLIN

```kotlin

val assetFile = Uri.parse("file:///android_asset/getting-started-guide.pdf")
PdfActivity.showDocument(context, assetFile, null, config)

val localDocument = Uri.fromFile(File(Environment.getExternalStorageDirectory(), "document.pdf"))
PdfActivity.showDocument(context, localDocument, null, config)

val contentProviderFile = Uri.parse("content://com.myapp.documents/repair-manuals/12345")
PdfActivity.showDocument(context, contentProviderFile, null, config)

```

### JAVA

```java

final Uri assetFile = Uri.parse("file:///android_asset/getting-started-guide.pdf");
PdfActivity.showDocument(context, assetFile, null, config);

final Uri localDocument = Uri.fromFile(new File(Environment.getExternalStorageDirectory(), "document.pdf"));
PdfActivity.showDocument(context, localDocument, null, config);

final Uri contentProviderFile = Uri.parse("content://com.myapp.documents/repair-manuals/12345");
PdfActivity.showDocument(context, contentProviderFile, null, config);

```

Access to files on the external storage requires the [`READ_EXTERNAL_STORAGE`](https://developer.android.com/reference/android/Manifest.permission.html#READ_EXTERNAL_STORAGE) permission (and the [`WRITE_EXTERNAL_STORAGE`](https://developer.android.com/reference/android/Manifest.permission.html#WRITE_EXTERNAL_STORAGE) permission if you want to write changes back to a PDF). Starting with Android 6.0 (API level 23), your app also needs to [acquire the permissions at runtime](https://developer.android.com/training/permissions/requesting.html) before accessing any file on the external storage.

### Launching from a URI or data providers using the intent builder

[`PdfActivityIntentBuilder`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-activity-intent-builder/index.html) provides full control over the document opening process. It allows you to control the source of the document (or multiple sources for joined documents), document passwords, content signatures, and custom activity for displaying the document.

#### URI

### KOTLIN

```kotlin

val assetFile = Uri.parse("file:///android_asset/getting-started-guide.pdf")
val intent = PdfActivityIntentBuilder.fromUri(context, assetFile).build()
context.startActivity(intent)

```

### JAVA

```java

final Uri assetFile = Uri.parse("file:///android_asset/getting-started-guide.pdf");
final Intent intent = PdfActivityIntentBuilder.fromUri(context, assetFile).build();
context.startActivity(intent);

```

#### Data providers

Using a [`DataProvider`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.providers/-data-provider/index.html), you can load documents from any non-standard document source — you can even define your own data provider. The full list of available data providers can be found in our [data providers](https://www.nutrient.io/guides/android/features/data-providers.md) guide:

### KOTLIN

```kotlin

// Same as using the `file:///android_asset/` Uri prefix in the example above.
val provider = AssetDataProvider("getting-started-guide.pdf")
val intent = PdfActivityIntentBuilder.fromDataProvider(context, provider).build()
context.startActivity(intent)

```

### JAVA

```java

// Same as using the `file:///android_asset/` Uri prefix in the example above.
final AssetDataProvider provider = new AssetDataProvider("getting-started-guide.pdf");
final Intent intent = PdfActivityIntentBuilder.fromDataProvider(context, provider).build();
context.startActivity(intent);

```

### Compound documents

You can also open multiple documents at once, creating a single “compound document.” Simply pass a list of document [`Uri`](http://developer.android.com/reference/android/net/Uri.html) instances or a list of data providers to [`PdfActivityIntentBuilder`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-activity-intent-builder/index.html):

### KOTLIN

```kotlin

val intent = PdfActivityIntentBuilder.fromUri(context, uri1, uri2, uri3).build()
context.startActivity(intent)

```

### JAVA

```java

final Intent intent = PdfActivityIntentBuilder.fromUri(context, uri1, uri2, uri3).build();
context.startActivity(intent);

```

Compound documents are also the basis for merging two documents back into one using the [document processing API](https://www.nutrient.io/guides/android/features/document-processing.md).

### More options

[`PdfActivityIntentBuilder`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-activity-intent-builder/index.html) provides more options than already stated, for example:

### KOTLIN

```kotlin

// Build the launching intent providing all required parameters.
val intent = PdfActivityIntentBuilder.fromUri(context, documentUri).configuration(config).activity(CustomActionsActivity.class).passwords("some_password").contentSignatures("some_doc_signature").build()

// As with every other Android intent, you can add `Intent` extras.
intent.putExtra("username", "John Doe")
intent.putExtra("age", 36)

// You can modify the intent flags as well if you need to.
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)

// Finally, launch the activity.
context.startActivity(intent)

```

### JAVA

```java

// Build the launching intent providing all required parameters.
final Intent intent = PdfActivityIntentBuilder.fromUri(context, documentUri).configuration(config).activity(CustomActionsActivity.class).passwords("some_password").contentSignatures("some_doc_signature").build();

// As with every other Android intent, you can add `Intent` extras.
intent.putExtra("username", "John Doe");
intent.putExtra("age", 36);

// You can modify the intent flags as well if you need to.
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

// Finally, launch the activity.
context.startActivity(intent);

```

You can also use [`PdfActivityIntentBuilder`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-activity-intent-builder/index.html) for creating intents that can be used to launch an activity for results, or as a pending intent (e.g. for notifications).
---

## Related pages

- [PDF display options on Android with PdfFragment](/guides/android/basics/using-fragment.md)
- [Load PDF documents on Android with PdfDocument class](/guides/android/basics/using-pdfdocument.md)

