public class

ContentViewer

extends AbsActivityStarter
java.lang.Object
   ↳ sofia.app.internal.AbsActivityStarter
     ↳ sofia.content.ContentViewer

Class Overview

Presents a full-screen viewer for content on the device. The content to display is denoted by its Uri; it can be any kind of content that supports the ACTION_VIEW intent, such as an image, video, sound, contact card, and many others.

This class should be used from an event handler in a Screen-like class. Display the content by calling the start(Activity) method. When the user returns from viewing the content, the contentViewerFinished method will be called on the screen, if it exists. For example:

 public class MyScreen extends Screen
 {
     public void buttonClicked()
     {
         new ContentViewer(uri).start(this);
     }
 
     public void contentViewerFinished(ContentViewer viewer)
     {
         // Do something when the viewer closes, if desired.
     }
 }

Summary

Public Constructors
ContentViewer(Uri uri)
Initializes a new content viewer that will display the content at the specified Uri.
Public Methods
Uri getUri()
Gets the Uri of the content that will be displayed by this viewer.
void setUri(Uri newUri)
Sets the Uri of the content that will be displayed by this viewer.
void start(Activity owner, String method)
Starts the content viewer.
void start(Activity owner)
Starts the content viewer.
Protected Methods
String getDefaultCallback()
[Expand]
Inherited Methods
From class sofia.app.internal.AbsActivityStarter
From class java.lang.Object

Public Constructors

public ContentViewer (Uri uri)

Initializes a new content viewer that will display the content at the specified Uri.

Parameters
uri the Uri of the content that will be displayed by this viewer

Public Methods

public Uri getUri ()

Gets the Uri of the content that will be displayed by this viewer.

Returns
  • the Uri to the content that will be displayed by this viewer

public void setUri (Uri newUri)

Sets the Uri of the content that will be displayed by this viewer.

Parameters
newUri the Uri to the content that will be displayed by this viewer

public void start (Activity owner, String method)

Starts the content viewer. When the user dismisses the viewer, the owning Activity (or Screen) will have the method with the name specified by method called.

Parameters
owner the activity or screen that owns this content viewer and will receive a notification when it is dismissed
method the name of the method that will be called on owner when the content viewer is dismissed

public void start (Activity owner)

Starts the content viewer. When the user dismisses the viewer, the owning Activity (or Screen) will have its contentViewerFinished method called.

Parameters
owner the activity or screen that owns this content viewer and will receive a notification when it is dismissed

Protected Methods

protected String getDefaultCallback ()