# FragmentGridPagerAdapter

Summary:[Inherited Constants](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter#inhconstants)\|[Inherited Fields](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter#inhfields)\|[Ctors](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter#pubctors)\|[Methods](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter#pubmethods)\|[Protected Methods](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter#promethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter#inhmethods)  

# FragmentGridPagerAdapter

`
public


abstract
class
FragmentGridPagerAdapter
`  
`


``

extends `[GridPagerAdapter](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html)`


``


`

|---|---|--------------------------------------------------------|
| [java.lang.Object](http://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [android.support.wearable.view.GridPagerAdapter](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html) ||
|   | ↳ | android.support.wearable.view.FragmentGridPagerAdapter |

<br />

*** ** * ** ***

<br />

**This class is deprecated.**   
starting with Android Wear 2.0 we no longer encourage bi-directional spacial models for apps. If you are looking to implement vertical paging pattern, consider using the[SnapHelper](https://developer.android.com/reference/android/support/v7/widget/SnapHelper.html)and a[RecyclerView](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html)instead.

An implementation of GridPagerAdapter which represents each page as a[Fragment](http://developer.android.com/reference/android/app/Fragment.html).

A minimal implementation needs only the abstract methods:[GridPagerAdapter.getRowCount()](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getRowCount()),[GridPagerAdapter.getColumnCount(int)](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getColumnCount(int)),[getFragment(int, int)](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#getFragment(int,%20int)).

If any changes are made to the data,[GridPagerAdapter.notifyDataSetChanged()](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#notifyDataSetChanged())must be called to notify the adapter of the change, so it can be reflected in the View.

If pages the data at be inserted or removed, performance can be improved by implementing[getFragmentId(int, int)](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#getFragmentId(int,%20int))to to provide a stable ID for each item, based on the content.

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                  ### Inherited constants                                                                                                                                                                                                                                                                                                                                                                                                  |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From class[android.support.wearable.view.GridPagerAdapter](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html) |-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `int` | [OPTION_DISABLE_PARALLAX](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#OPTION_DISABLE_PARALLAX) Disables zooming and parallax scrolling of the background. | | `int` | [PAGE_DEFAULT_OPTIONS](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#PAGE_DEFAULT_OPTIONS) Default background options.                                      | |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ### Inherited fields                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From class[android.support.wearable.view.GridPagerAdapter](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html) |-------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` public static final `[Drawable](http://developer.android.com/reference/android/graphics/drawable/Drawable.html) | [BACKGROUND_NONE](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#BACKGROUND_NONE) This value indicates that no background should drawn. | | ` public static final `[Point](http://developer.android.com/reference/android/graphics/Point.html)                | [POSITION_NONE](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#POSITION_NONE) <br />                                                    | | ` public static final `[Point](http://developer.android.com/reference/android/graphics/Point.html)                | [POSITION_UNCHANGED](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#POSITION_UNCHANGED) <br />                                          | |

|                                                                                                                                     ### Public constructors                                                                                                                                     ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[FragmentGridPagerAdapter](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#FragmentGridPagerAdapter(android.app.FragmentManager))`(`[FragmentManager](http://developer.android.com/reference/android/app/FragmentManager.html)` fm) ` |

|                                                                                                                                                                                                                                                                                                                                                             ### Public methods                                                                                                                                                                                                                                                                                                                                                             ||
|-----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void`                                                                                             | ` `[destroyItem](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#destroyItem(android.view.ViewGroup,%20int,%20int,%20java.lang.Object))`(`[ViewGroup](http://developer.android.com/reference/android/view/ViewGroup.html)` container, int row, int column, `[Object](http://developer.android.com/reference/java/lang/Object.html)` object) ` Removes a page for the given position.                                                                                                                                                                                              |
| ` `[Fragment](http://developer.android.com/reference/android/app/Fragment.html)                     | ` `[findExistingFragment](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#findExistingFragment(int,%20int))`(int row, int column) `                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ` void`                                                                                             | ` `[finishUpdate](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#finishUpdate(android.view.ViewGroup))`(`[ViewGroup](http://developer.android.com/reference/android/view/ViewGroup.html)` container) ` Called when the a change in the shown pages has been completed.                                                                                                                                                                                                                                                                                                           |
| ` `[Drawable](http://developer.android.com/reference/android/graphics/drawable/Drawable.html)       | ` `[getBackgroundForPage](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#getBackgroundForPage(int,%20int))`(int row, int column) ` Provides content to be displayed as the background for a specific page.                                                                                                                                                                                                                                                                                                                                                                       |
| ` abstract `[Fragment](http://developer.android.com/reference/android/app/Fragment.html)            | ` `[getFragment](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#getFragment(int,%20int))`(int row, int column) ` Returns the[Fragment](http://developer.android.com/reference/android/app/Fragment.html)at the specified row number and column number.                                                                                                                                                                                                                                                                                                                           |
| ` final `[Drawable](http://developer.android.com/reference/android/graphics/drawable/Drawable.html) | ` `[getFragmentBackground](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#getFragmentBackground(int,%20int))`(int row, int column) ` Returns a background for Fragments implementing[GridPageOptions](https://developer.android.com/reference/android/support/wearable/view/GridPageOptions.html).                                                                                                                                                                                                                                                                               |
| ` long`                                                                                             | ` `[getFragmentId](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#getFragmentId(int,%20int))`(int row, int column) ` Returns a unique identifier for the[Fragment](http://developer.android.com/reference/android/app/Fragment.html)at the given row/column position.                                                                                                                                                                                                                                                                                                            |
| ` `[Fragment](http://developer.android.com/reference/android/app/Fragment.html)                     | ` `[instantiateItem](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#instantiateItem(android.view.ViewGroup,%20int,%20int))`(`[ViewGroup](http://developer.android.com/reference/android/view/ViewGroup.html)` container, int row, int column) ` Creates the page for the given position.                                                                                                                                                                                                                                                                                         |
| ` boolean`                                                                                          | ` `[isViewFromObject](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#isViewFromObject(android.view.View,%20java.lang.Object))`(`[View](http://developer.android.com/reference/android/view/View.html)` view, `[Object](http://developer.android.com/reference/java/lang/Object.html)` object) ` Determines whether a page View is associated with a specific key object as returned by[instantiateItem(ViewGroup, int, int)](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#instantiateItem(android.view.ViewGroup,%20int,%20int)). |

|                                                                                                                                                                                                                                                                                                                                                                                        ### Protected methods                                                                                                                                                                                                                                                                                                                                                                                        ||
|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void` | ` `[applyItemPosition](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#applyItemPosition(java.lang.Object,%20android.graphics.Point))`(`[Object](http://developer.android.com/reference/java/lang/Object.html)` object, `[Point](http://developer.android.com/reference/android/graphics/Point.html)` position) ` Called after[getItemPosition(Object)](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getItemPosition(java.lang.Object))to allow superclasses to update their internal bookkeeping if a subclass has overridden[getItemPosition(Object)](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getItemPosition(java.lang.Object)). |
| ` void` | ` `[removeFragment](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#removeFragment(android.app.Fragment,%20android.app.FragmentTransaction))`(`[Fragment](http://developer.android.com/reference/android/app/Fragment.html)` fragment, `[FragmentTransaction](http://developer.android.com/reference/android/app/FragmentTransaction.html)` transaction) `                                                                                                                                                                                                                                                                                                                                                                             |
| ` void` | ` `[restoreFragment](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#restoreFragment(android.app.Fragment,%20android.app.FragmentTransaction))`(`[Fragment](http://developer.android.com/reference/android/app/Fragment.html)` fragment, `[FragmentTransaction](http://developer.android.com/reference/android/app/FragmentTransaction.html)` transaction) `                                                                                                                                                                                                                                                                                                                                                                           |

| ### Inherited methods |
|-----------------------|---|
| From class` `[android.support.wearable.view.GridPagerAdapter](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html)` ` |-----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` void`                                                                                       | ` `[applyItemPosition](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#applyItemPosition(java.lang.Object,%20android.graphics.Point))`(`[Object](http://developer.android.com/reference/java/lang/Object.html)` object, `[Point](http://developer.android.com/reference/android/graphics/Point.html)` position) ` Called after[getItemPosition(Object)](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getItemPosition(java.lang.Object))to allow superclasses to update their internal bookkeeping if a subclass has overridden[getItemPosition(Object)](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getItemPosition(java.lang.Object)). | | ` abstract void`                                                                              | ` `[destroyItem](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#destroyItem(android.view.ViewGroup,%20int,%20int,%20java.lang.Object))`(`[ViewGroup](http://developer.android.com/reference/android/view/ViewGroup.html)` container, int row, int column, `[Object](http://developer.android.com/reference/java/lang/Object.html)` object) ` Removes a page for the given position.                                                                                                                                                                                                                                                                                                                                                   | | ` void`                                                                                       | ` `[finishUpdate](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#finishUpdate(android.view.ViewGroup))`(`[ViewGroup](http://developer.android.com/reference/android/view/ViewGroup.html)` container) ` Called when the a change in the shown pages has been completed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` `[Drawable](http://developer.android.com/reference/android/graphics/drawable/Drawable.html) | ` `[getBackgroundForPage](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getBackgroundForPage(int,%20int))`(int row, int column) ` Provides content to be displayed as background for a specific page.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` `[Drawable](http://developer.android.com/reference/android/graphics/drawable/Drawable.html) | ` `[getBackgroundForRow](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getBackgroundForRow(int))`(int row) ` Provides content to be displayed as the default background for all pages on the given row.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` abstract int`                                                                               | ` `[getColumnCount](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getColumnCount(int))`(int row) ` Returns the maximum number of columns for each row.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | | ` int`                                                                                        | ` `[getCurrentColumnForRow](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getCurrentColumnForRow(int,%20int))`(int row, int currentColumn) ` Returns the column to arrive at when navigating vertically to the specified row.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | ` `[Point](http://developer.android.com/reference/android/graphics/Point.html)                | ` `[getItemPosition](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getItemPosition(java.lang.Object))`(`[Object](http://developer.android.com/reference/java/lang/Object.html)` object) ` Called when the host view is attempting to determine if an item's position has changed.                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | ` int`                                                                                        | ` `[getOptionsForPage](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getOptionsForPage(int,%20int))`(int row, int column) ` Provides a set of features to apply to a page background.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` abstract int`                                                                               | ` `[getRowCount](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getRowCount())`() ` Returns the number of rows available.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | ` abstract `[Object](http://developer.android.com/reference/java/lang/Object.html)            | ` `[instantiateItem](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#instantiateItem(android.view.ViewGroup,%20int,%20int))`(`[ViewGroup](http://developer.android.com/reference/android/view/ViewGroup.html)` container, int row, int column) ` Creates the page for the given position.                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` abstract boolean`                                                                           | ` `[isViewFromObject](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#isViewFromObject(android.view.View,%20java.lang.Object))`(`[View](http://developer.android.com/reference/android/view/View.html)` view, `[Object](http://developer.android.com/reference/java/lang/Object.html)` object) ` Determines whether a page View is associated with a specific key object as returned by[instantiateItem(ViewGroup, int, int)](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#instantiateItem(android.view.ViewGroup,%20int,%20int)).                                                                                                                                                      | | ` void`                                                                                       | ` `[notifyDataSetChanged](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#notifyDataSetChanged())`() ` This method should be called by the application if the data backing this adapter has changed and associated views should update.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | ` void`                                                                                       | ` `[notifyPageBackgroundChanged](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#notifyPageBackgroundChanged(int,%20int))`(int row, int column) ` This method should be called if the value returned by[getBackgroundForPage(int, int)](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getBackgroundForPage(int,%20int))or options returned by[getOptionsForPage(int, int)](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getOptionsForPage(int,%20int))change.                                                                                                                                                                             | | ` void`                                                                                       | ` `[notifyRowBackgroundChanged](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#notifyRowBackgroundChanged(int))`(int row) ` This method should be called if the value returned by[getBackgroundForRow(int)](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getBackgroundForRow(int))changes.                                                                                                                                                                                                                                                                                                                                                                                             | | ` void`                                                                                       | ` `[registerDataSetObserver](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#registerDataSetObserver(android.database.DataSetObserver))`(`[DataSetObserver](http://developer.android.com/reference/android/database/DataSetObserver.html)` observer) ` Register an observer to receive callbacks related to the adapter's data changing.                                                                                                                                                                                                                                                                                                                                                                                               | | ` void`                                                                                       | ` `[restoreState](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#restoreState(android.os.Parcelable,%20java.lang.ClassLoader))`(`[Parcelable](http://developer.android.com/reference/android/os/Parcelable.html)` savedState, `[ClassLoader](http://developer.android.com/reference/java/lang/ClassLoader.html)` classLoader) ` Restores the previously saved state of this adapter.                                                                                                                                                                                                                                                                                                                                                  | | ` `[Parcelable](http://developer.android.com/reference/android/os/Parcelable.html)            | ` `[saveState](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#saveState())`() ` Saves the current state of this adapter.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` void`                                                                                       | ` `[setCurrentColumnForRow](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#setCurrentColumnForRow(int,%20int))`(int row, int currentColumn) ` Called to inform the adapter of which column is now current for the given row.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | | ` void`                                                                                       | ` `[startUpdate](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#startUpdate(android.view.ViewGroup))`(`[ViewGroup](http://developer.android.com/reference/android/view/ViewGroup.html)` container) ` Called when a change in the shown pages is going to start being made.                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | ` void`                                                                                       | ` `[unregisterDataSetObserver](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#unregisterDataSetObserver(android.database.DataSetObserver))`(`[DataSetObserver](http://developer.android.com/reference/android/database/DataSetObserver.html)` observer) ` Unregister an observer from callbacks related to the adapter's data changing.                                                                                                                                                                                                                                                                                                                                                                                               | ||
| From class` `[java.lang.Object](http://developer.android.com/reference/java/lang/Object.html)` ` |------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------| | ` `[Object](http://developer.android.com/reference/java/lang/Object.html)          | ` clone() `                                                                               | | ` boolean`                                                                         | ` equals(`[Object](http://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` void`                                                                            | ` finalize() `                                                                            | | ` final `[Class](http://developer.android.com/reference/java/lang/Class.html)`<?>` | ` getClass() `                                                                            | | ` int`                                                                             | ` hashCode() `                                                                            | | ` final void`                                                                      | ` notify() `                                                                              | | ` final void`                                                                      | ` notifyAll() `                                                                           | | ` `[String](http://developer.android.com/reference/java/lang/String.html)          | ` toString() `                                                                            | | ` final void`                                                                      | ` wait(long arg0, int arg1) `                                                             | | ` final void`                                                                      | ` wait(long arg0) `                                                                       | | ` final void`                                                                      | ` wait() `                                                                                | ||

## Public constructors

### FragmentGridPagerAdapter

```
public FragmentGridPagerAdapter (FragmentManager fm)
```

<br />

<br />

|           Parameters           ||
|------|--------------------------|
| `fm` | `FragmentManager` <br /> |

## Public methods

### destroyItem

```
public void destroyItem (ViewGroup container, 
                int row, 
                int column, 
                Object object)
```

Removes a page for the given position. The adapter is responsible for removing the view from its container, although it only must ensure this is done by the time it returns from[finishUpdate(ViewGroup)](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#finishUpdate(android.view.ViewGroup)).

<br />

|                                                                                                                              Parameters                                                                                                                              ||
|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `container` | `ViewGroup`: The containing View from which the page will be removed. <br />                                                                                                                                                                            |
| `row`       | `int`: the row to be destroyed <br />                                                                                                                                                                                                                   |
| `column`    | `int`: the column within the row to be destroyed <br />                                                                                                                                                                                                 |
| `object`    | `Object`: The same object that was returned by[instantiateItem(ViewGroup, int, int)](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#instantiateItem(android.view.ViewGroup,%20int,%20int)). <br /> |

### findExistingFragment

```
public Fragment findExistingFragment (int row, 
                int column)
```

<br />

<br />

|       Parameters       ||
|----------|--------------|
| `row`    | `int` <br /> |
| `column` | `int` <br /> |

|                                       Returns                                        ||
|------------------------------------------------------------------------------|--------|
| [Fragment](http://developer.android.com/reference/android/app/Fragment.html) | <br /> |

### finishUpdate

```
public void finishUpdate (ViewGroup container)
```

Called when the a change in the shown pages has been completed. At this point you must ensure that all of the pages have actually been added or removed from the container as appropriate.

<br />

|                                             Parameters                                             ||
|-------------|---------------------------------------------------------------------------------------|
| `container` | `ViewGroup`: The containing View which is displaying this adapter's page views <br /> |

### getBackgroundForPage

```
public Drawable getBackgroundForPage (int row, 
                int column)
```

Provides content to be displayed as the background for a specific page.

The return value[GridPagerAdapter.BACKGROUND_NONE](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#BACKGROUND_NONE)indicates that there is no page-specific background. and the row background should be used (if any).

This implementation simply returns the result of[getFragmentBackground(int, int)](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#getFragmentBackground(int,%20int)).

<br />

|                   Parameters                   ||
|----------|--------------------------------------|
| `row`    | `int`: the row of the page <br />    |
| `column` | `int`: the column of the page <br /> |

|                                                                                                                                        Returns                                                                                                                                         ||
|--------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Drawable](http://developer.android.com/reference/android/graphics/drawable/Drawable.html) | the background for the given page or[GridPagerAdapter.BACKGROUND_NONE](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#BACKGROUND_NONE) <br /> |

### getFragment

```
public abstract Fragment getFragment (int row, 
                int column)
```

Returns the[Fragment](http://developer.android.com/reference/android/app/Fragment.html)at the specified row number and column number.

Fragment instances MAY be stored and reused ONLY if no structural changes are made to the data set or if[getFragmentId(int, int)](https://developer.android.com/reference/android/support/wearable/view/FragmentGridPagerAdapter.html#getFragmentId(int,%20int))is overridden to provide a stable identifier for each the item at each position, otherwise results are undefined.

<br />

|                     Parameters                     ||
|----------|------------------------------------------|
| `row`    | `int`: the row of the position <br />    |
| `column` | `int`: the column of the position <br /> |

|                                       Returns                                        ||
|------------------------------------------------------------------------------|--------|
| [Fragment](http://developer.android.com/reference/android/app/Fragment.html) | <br /> |

### getFragmentBackground

```
public final Drawable getFragmentBackground (int row, 
                int column)
```

Returns a background for Fragments implementing[GridPageOptions](https://developer.android.com/reference/android/support/wearable/view/GridPageOptions.html).

<br />

|                     Parameters                     ||
|----------|------------------------------------------|
| `row`    | `int`: the row of the fragment <br />    |
| `column` | `int`: the column of the fragment <br /> |

|                                                                                                                                                                                                           Returns                                                                                                                                                                                                           ||
|--------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Drawable](http://developer.android.com/reference/android/graphics/drawable/Drawable.html) | the background drawable or[GridPagerAdapter.BACKGROUND_NONE](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#BACKGROUND_NONE)if the fragment does not implement[GridPageOptions](https://developer.android.com/reference/android/support/wearable/view/GridPageOptions.html) <br /> |

### getFragmentId

```
public long getFragmentId (int row, 
                int column)
```

Returns a unique identifier for the[Fragment](http://developer.android.com/reference/android/app/Fragment.html)at the given row/column position.

The default implementation returns a fixed number based on the position. Subclasses should override this method if the positions of items can change.

<br />

|                               Parameters                               ||
|----------|--------------------------------------------------------------|
| `row`    | `int`: the row that this item is at <br />                   |
| `column` | `int`: the column within this row that the item is at <br /> |

|                          Returns                          ||
|--------|---------------------------------------------------|
| `long` | Unique identifier for the item at position <br /> |

### instantiateItem

```
public Fragment instantiateItem (ViewGroup container, 
                int row, 
                int column)
```

Creates the page for the given position. The adapter is responsible for adding the view to the container given here, although it only must ensure this is done by the time it returns from[finishUpdate(ViewGroup)](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#finishUpdate(android.view.ViewGroup))

<br />

|                                    Parameters                                    ||
|-------------|---------------------------------------------------------------------|
| `container` | `ViewGroup`: containing View in which the page will be shown <br /> |
| `row`       | `int`: the row to be instantiated <br />                            |
| `column`    | `int`: the column within the row to be instantiated <br />          |

|                                                          Returns                                                           ||
|------------------------------------------------------------------------------|----------------------------------------------|
| [Fragment](http://developer.android.com/reference/android/app/Fragment.html) | a an object representing the new page <br /> |

### isViewFromObject

```
public boolean isViewFromObject (View view, 
                Object object)
```

Determines whether a page View is associated with a specific key object as returned by[instantiateItem(ViewGroup, int, int)](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#instantiateItem(android.view.ViewGroup,%20int,%20int)). This method is required for a PagerAdapter to function properly.

<br />

|                                Parameters                                ||
|----------|----------------------------------------------------------------|
| `view`   | `View`: Page View to check for association with`object` <br /> |
| `object` | `Object`: Object to check for association with`view` <br />    |

|                                 Returns                                  ||
|-----------|---------------------------------------------------------------|
| `boolean` | true if`view`is associated with the key object`object` <br /> |

## Protected methods

### applyItemPosition

```
protected void applyItemPosition (Object object, 
                Point position)
```

Called after[getItemPosition(Object)](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getItemPosition(java.lang.Object))to allow superclasses to update their internal bookkeeping if a subclass has overridden[getItemPosition(Object)](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getItemPosition(java.lang.Object)).

<br />

|                                                                                                                  Parameters                                                                                                                   ||
|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `object`   | `Object`: Object representing the item passed to[GridPagerAdapter.getItemPosition(Object)](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getItemPosition(java.lang.Object)). <br /> |
| `position` | `Point`: position which was returned from[GridPagerAdapter.getItemPosition(Object)](https://developer.android.com/reference/android/support/wearable/view/GridPagerAdapter.html#getItemPosition(java.lang.Object)). <br />        |

### removeFragment

```
protected void removeFragment (Fragment fragment, 
                FragmentTransaction transaction)
```

<br />

<br />

|                 Parameters                  ||
|---------------|------------------------------|
| `fragment`    | `Fragment` <br />            |
| `transaction` | `FragmentTransaction` <br /> |

### restoreFragment

```
protected void restoreFragment (Fragment fragment, 
                FragmentTransaction transaction)
```

<br />

<br />

|                 Parameters                  ||
|---------------|------------------------------|
| `fragment`    | `Fragment` <br />            |
| `transaction` | `FragmentTransaction` <br /> |