|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.media.MediaScannerConnection
public class MediaScannerConnection
MediaScannerConnection provides a way for applications to pass a newly created or downloaded media file to the media scanner service. The media scanner service will read metadata from the file and add the file to the media content provider. The MediaScannerConnectionClient provides an interface for the media scanner service to return the Uri for a newly scanned file to the client of the MediaScannerConnection class.
| Nested Class Summary | |
|---|---|
static interface |
MediaScannerConnection.MediaScannerConnectionClient
An interface for notifying clients of MediaScannerConnection when a connection to the MediaScanner service has been established and when the scanning of a file has completed. |
| Constructor Summary | |
|---|---|
MediaScannerConnection(Context context,
MediaScannerConnection.MediaScannerConnectionClient client)
Constructs a new MediaScannerConnection object. |
|
| Method Summary | |
|---|---|
void |
connect()
Initiates a connection to the media scanner service. |
void |
disconnect()
Releases the connection to the media scanner service. |
boolean |
isConnected()
Returns whether we are connected to the media scanner service |
void |
onServiceConnected(ComponentName className,
IBinder service)
Part of the ServiceConnection interface. |
void |
onServiceDisconnected(ComponentName className)
Part of the ServiceConnection interface. |
void |
scanFile(String path,
String mimeType)
Requests the media scanner to scan a file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MediaScannerConnection(Context context,
MediaScannerConnection.MediaScannerConnectionClient client)
context - the Context object, required for establishing a connection to
the media scanner service.client - an optional object implementing the MediaScannerConnectionClient
interface, for receiving notifications from the media scanner.| Method Detail |
|---|
public void connect()
MediaScannerConnection.MediaScannerConnectionClient.onMediaScannerConnected()
will be called when the connection is established.
public void disconnect()
public boolean isConnected()
public void scanFile(String path,
String mimeType)
path - the path to the file to be scanned.mimeType - an optional mimeType for the file.
If mimeType is null, then the mimeType will be inferred from the file extension.
Success or failure of the scanning operation cannot be determined until
MediaScannerConnection.MediaScannerConnectionClient.onScanCompleted(String, Uri) is called.
public void onServiceConnected(ComponentName className,
IBinder service)
onServiceConnected in interface ServiceConnectionclassName - The concrete component name of the service that has
been connected.service - The IBinder of the Service's communication channel,
which you can now make calls on.public void onServiceDisconnected(ComponentName className)
onServiceDisconnected in interface ServiceConnectionclassName - The concrete component name of the service whose
connection has been lost.
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||