Android obtains audio, video, and image information

Source: Internet
Author: User

MediaStore provides audio, video, and image information, which can be read through ContentResolver.

First, we provide three classes: Audio, Video, and Image. Then we define three providers: AudioProvider,

VideoProvider, ImageProvider, looks like the factory method mode is used: D, finally, an example class Provider is provided.

View Code
Package com. provider; public class Audio {

Private int id;

Private String title;

Private String album;

Private String artist;

Private String path;

Private String displayName;

Private String mimeType;

Private long duration;

Private long size;

/*****/Public Audio (){

Super ();

}

/**

* @ Param id

* @ Param title

* @ Param album

* @ Param artist

* @ Param path

* @ Param displayName

* @ Param mimeType

* @ Param duration

* @ Param size

*/

Public Audio (int id, String title, String album, String artist, String path, String displayName, String mimeType, long duration, long size ){

Super ();

This. id = id;

This. title = title;

This. album = album;

This. artist = artist;

This. path = path;

This. displayName = displayName;

This. mimeType = mimeType;

This. duration = duration;

This. size = size;

}

Public int getId (){

Return id;

}

Public void setId (int id ){

This. id = id;

}

Public String getTitle (){

Return title;

}

Public void setTitle (String title ){

This. title = title;

}

Public String getAlbum (){

Return album;

}

Public void setAlbum (String album ){

This. album = album;

}

Public String getArtist (){

Return artist;

}

Public void setArtist (String artist ){

This. artist = artist;

}

Public String getPath (){

Return path;

}

Public void setPath (String path ){

This. path = path;

}

Public String getDisplayName (){

Return displayName;

}

Public void setDisplayName (String displayName ){

This. displayName = displayName;

}

Public String getMimeType (){

Return mimeType;

}

Public void setMimeType (String mimeType ){

This. mimeType = mimeType;

}

Public long getDuration (){

Return duration;

}

Public void setDuration (long duration ){

This. duration = duration;

}

Public long getSize (){

Return size;

}

Public void setSize (long size ){

This. size = size;

}

}

View Code
Package com. provider; public class Video {

Private int id;

Private String title;

Private String album;

Private String artist;

Private String displayName;

Private String mimeType;

Private String path;

Private long size;

Private long duration;

/****/

Public Video (){

Super ();

}

/**

* @ Param id

* @ Param title

* @ Param album

* @ Param artist

* @ Param displayName

* @ Param mimeType

* @ Param data

* @ Param size

* @ Param duration

*/

Public Video (int id, String title, String album, String artist, String displayName, String mimeType, String path, long size, long duration) {super ();

This. id = id;

This. title = title;

This. album = album;

This. artist = artist;

This. displayName = displayName;

This. mimeType = mimeType;

This. path = path;

This. size = size;

This. duration = duration;

}

Public int getId (){

Return id;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.