AbsActivityStarter
java.lang.Object
AbsActivityStarter
Allows the user to choose a piece of media (such as an image or a video) from the media gallery on his or her device.
This class should be used from an event handler in a Screen
subclass. Display the media chooser by calling the start(Activity)
method. When a selection is made, the mediaWasChosen
method will be
called on the screen, if it exists. For example:
public class MyScreen extends Screen { public void buttonClicked() { MediaChooser chooser = new MediaChooser(); chooser.start(this); } public void mediaWasChosen(MediaChooser chooser) { // Do something with the media by calling chooser.getBitmap(), // chooser.getUri(), or chooser.getPath(). } }
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
MediaChooser()
Initializes a new media chooser that, by default, has the content type
image/* . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Bitmap
|
getBitmap()
A convenience method that returns the chosen image as a
Bitmap
if the selected media was an image. | ||||||||||
String
|
getPath()
Gets the file system path of the media that was chosen in the media
chooser.
| ||||||||||
String
|
getType()
Gets the content type of the acceptable kinds of media that can be
selected by this media chooser.
| ||||||||||
Uri
|
getUri()
Gets the Uri (uniform resource identifier) of the media that was
chosen in the media chooser.
| ||||||||||
void
|
handleActivityResult(Activity owner, Intent data, int requestCode, int resultCode)
| ||||||||||
void
|
setType(String newType)
Sets the content type (also known as the MIME type or internet media type) of the acceptable kinds of media that can be selected by this media chooser. | ||||||||||
void
|
start(Activity owner, String method)
Starts the media chooser.
| ||||||||||
void
|
start(Activity owner)
Starts the media chooser.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String
|
getDefaultCallback()
|
Methods inherited from
class
java.lang.Object
| |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Object
|
clone()
| ||||||||||
boolean
|
equals(Object arg0)
| ||||||||||
void
|
finalize()
| ||||||||||
final
Class<?>
|
getClass()
| ||||||||||
int
|
hashCode()
| ||||||||||
final
void
|
notify()
| ||||||||||
final
void
|
notifyAll()
| ||||||||||
String
|
toString()
| ||||||||||
final
void
|
wait()
| ||||||||||
final
void
|
wait(long arg0, int arg1)
| ||||||||||
final
void
|
wait(long arg0)
|
Initializes a new media chooser that, by default, has the content type
image/*
.
A convenience method that returns the chosen image as a Bitmap
if the selected media was an image. Otherwise, the method returns null.
a Bitmap
that represents the image that was chosen, or
null if it was not an image
Gets the file system path of the media that was chosen in the media chooser.
the file system path of the media that was chosen
Gets the content type of the acceptable kinds of media that can be selected by this media chooser.
the content type for this media chooser
Gets the Uri (uniform resource identifier) of the media that was chosen in the media chooser.
the Uri of the media that was chosen
Sets the content type (also known as the MIME type or internet media
type) of the acceptable kinds of media that can be selected by this
media chooser. This content type can be a specific individual type
(such as image/jpeg
) or include a wildcard to support multiple
related types (e.g., image/*
or video/*
).
More information about content types can be found in the Wikipedia article Internet media types.
Starts the media chooser. When the user has chosen an item from the
media gallery, the owning Activity
(or Screen
) will
have the method with the name specified by method
called.
owner
when a media item is chosen
Starts the media chooser. When the user has chosen an item from the
media gallery, the owning Activity
(or Screen
) will
have its mediaWasChosen
method called.