# VR View for Android

> [!WARNING]
> **Warning:** These components were removed in v1.190 of the GVR SDK for Android. The [Video360 sample](https://developers.google.com/vr/android/samples/video360) should be used as a basis for creating 360 photo and video viewers. If you still want to use these widgets, you will need to use SDK v1.180 or earlier.

This page is a walkthrough of the VR View samples, which can be found in the
`/samples` directory when you [download](https://developers.google.com/vr/android/download) the Google VR SDK
for Android.

## Sample apps

There are two sample apps in the SDK that demonstrate how to embed
[360° media](https://developers.google.com/vr/discover/360-degree-media).
Both of samples are single activity applications that display an embedded
panoramic image or video:

- **VrPanoramaView**

- **VrVideoView**


*The VrPanoramaView and VrVideoView samples with their VR Views in embed mode.*

They allow the user to view different parts of the panorama by rotating their
phone. The **VrVideoView** sample also allows the user to pause and play
their video by tapping on the VR View, and seek through the video using the
slider. The samples expose the **fullscreen mode** and **Cardboard mode**
buttons in the VR View which allow the user to change modes.

*The fullscreen mode is similar to the embed mode but is immersive.*

*The Cardboard mode allows the user to view the panorama in a Cardboard
device like any other Cardboard app.*

These two apps also have an additional feature of opening arbitrary panoramas
using custom Intents via adb. The syntax for the Intents is documented in the
samples' respective Activities, and these Intents can be used to quickly test
various media formats.

### Overview of the code

A VR View can be included in a layout like any other Android View. This is the
important section of the VrPanoramaView's `res/layout/main_layout.xml`:

```
<com.google.vr.sdk.widgets.pano.VrPanoramaView
    android:id="@+id/pano_view"
    android:layout_margin="5dip"
    android:layout_width="match_parent"
    android:scrollbars="@null"
    android:layout_height="250dip" />
```

Inside the Activity, the primary method is
[`VrPanoramaView.loadImageFromBitmap()`](https://developers.google.com/vr/android/reference/com/google/vr/sdk/widgets/pano/VrPanoramaView#public-methods_2). Call
it with a standard Android `Bitmap` object and an optional
[`VrPanoramaView.Options`](https://developers.google.com/vr/android/reference/com/google/vr/sdk/widgets/pano/VrPanoramaView.Options)
object. The latter is used to configure the format of the image. The Activity
also implements a
[`VrPanoramaEventListener`](https://developers.google.com/vr/android/reference/com/google/vr/sdk/widgets/pano/VrPanoramaEventListener)
which receives events when the load operation succeeds or fails.

The **VrVideoView** sample uses a very similar flow to **VrPanoramaView** .
The primary difference is that **VrVideoView** uses either
[`loadVideoFromAsset`](https://developers.google.com/vr/android/reference/com/google/vr/sdk/widgets/video/VrVideoView#loadVideoFromAsset(java.lang.String,%20com.google.vr.sdk.widgets.video.VrVideoView.Options))
or
[`loadVideo`](https://developers.google.com/vr/android/reference/com/google/vr/sdk/widgets/video/VrVideoView#loadVideo(android.net.Uri,%20com.google.vr.sdk.widgets.video.VrVideoView.Options)).

While `VrPanoramaView` requires the caller to load the image and pass in
configuration information, `VrVideoView` accepts a file and reads in the
configuration from the file's
[spatial-media](https://github.com/google/spatial-media/blob/master/docs/spherical-video-rfc.md)
metadata.