---
title: "Android PDF viewer page navigations | Nutrient SDK"
canonical_url: "https://www.nutrient.io/guides/android/basics/document-interactions/"
md_url: "https://www.nutrient.io/guides/android/basics/document-interactions.md"
last_updated: "2026-05-20T19:49:34.731Z"
description: "After loading a PDF document, you can programmatically interact with it, which lets you scroll to different pages or zoom in and out."
---

# Customizing page navigation in our Android PDF viewer

After loading a PDF document, you can programmatically interact with it, which allows you to scroll to different pages or zoom in and out. All of the interaction APIs are available on the [`PdfFragment`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/index.html), which is the core PDF viewer. Furthermore, most methods are also available on the [`PdfActivity`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-activity/index.html).

## Changing the current page

While the user can manually change the current page by doing a swipe gesture on the device, you can also programmatically change pages using [`setPageIndex(int)`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/set-page-index.html) and [`setPageIndex(int, boolean)`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/set-page-index.html). You can fetch the current page using [`getPageIndex()`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/get-page-index.html):

### KOTLIN

```kotlin

val startPage = fragment.getPageIndex()

// Change to page 13 (zero-based page numbers).
fragment.pageIndex = 12

// Go to the last page using a transitioning animation.
val lastPage = document.pageCount - 1
fragment.setPageIndex(lastPage, true)

// Go back to the page where you started off.
fragment.setPageIndex(startPage)

```

### JAVA

```java

final int startPage = fragment.getPageIndex();

// Change to page 13 (zero-based page numbers).
fragment.setPageIndex(12);

// Go to the last page using a transitioning animation.
int lastPage = document.getPageCount() - 1;
fragment.setPageIndex(lastPage, true);

// Go back to the page where you started off.
fragment.setPageIndex(startPage);

```

While [`setPageIndex(int, boolean)`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/set-page-index.html) gives you complete control of choosing whether or not a page transitioning animation should be performed, [`setPageIndex(int)`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/set-page-index.html) will intelligently decide whether or not an animation is suitable for the current situation.

### Restore the last viewed page

By default, [`PdfFragment`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.ui/-pdf-fragment/index.html) will remember the last viewed page of a document and will restore it when loading the document at a later point. This usually provides a better experience when using a document across several sessions. If you would like to disable this mechanism, you can set [`PdfConfiguration#restoreLastViewedPage`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.configuration/-pdf-configuration/-builder/restore-last-viewed-page.html) to `false`:

### KOTLIN

```kotlin

val config = PdfConfiguration.Builder().restoreLastViewedPage(false).build()

```

### JAVA

```java

final PdfConfiguration config = new PdfConfiguration.Builder().restoreLastViewedPage(false).build();

```
---

## Related pages

- [Android image viewer library](/guides/android/viewer/images.md)
- [Create efficient Android PDF viewers for apps](/guides/android/viewer/java.md)
- [Android PDF viewer library](/guides/android/viewer.md)
- [Fast and feature-rich PDF viewer for Android apps](/guides/android/viewer/kotlin.md)
- [Configuring scroll directions and page transitions in our Android viewer](/guides/android/customizing-the-interface/document-presentation-options.md)
- [Mastering PDF permissions in Android apps](/guides/android/viewer/permissions.md)
- [Enhance your Android PDF viewer with JavaScript support](/guides/android/features/javascript.md)
- [Selecting text in Android PDF viewer](/guides/android/features/text-selection.md)
- [Android PDF  iewer troubleshooting](/guides/android/viewer/troubleshooting.md)
- [Using the view state to display PDFs on Android](/guides/android/view-management/store-load-view-state.md)
- [Customizing zoom options in our Android PDF viewer](/guides/android/miscellaneous/zooming.md)

