All of the multimedia files in the 1.Android are stored on the physical hard disk, and the file information (path, ID, type,) is saved to the database, so that when we want to get the information of these files, we don't need to scan the hard disk for time, we just need to read the database. The Android platform says that the phone terminal memory is an internal storage space, which is called the SD card as an external storage space. The information about media files in internal and external storage is managed separately, and each has its own database management. The volume labeled "External" and "internal" corresponds to the external storage space and the internal storage space. 2. The data of the database will be exposed by the corresponding content provider, according to the pre-defined URI, This data can be easily obtained 3. Android has a service dedicated to adding file information scanning to the database, the service is powered on (listening for power on), or the developer can proactively send a broadcast update database at a specific time, such as just saving a picture to be seen at galleries immediately.
The following code shows how to get some data for a mobile video file
Contentresolver contentresolver=Context.getcontentresolver (); Uri URI=MediaStore.Video.Media.EXTERNAL_CONTENT_URI; string[] Projection={MediaStore.Video.Media.DISPLAY_NAME,//The name of the video in the SD cardMediaStore.Video.Media.DURATION,//Video DurationMediaStore.Video.Media.SIZE,//the size of the video fileMediaStore.Video.Media.DATA,//absolute path to videoMediaStore.Video.Media.ARTIST//artist }; Cursor Cursor=contentresolver.query (Uri,projection,NULL,NULL,NULL);
Traverse the cursor to get data from your phone's video files
If you want to get an audio file, use the MediaStore.Audio.Media.EXTERNAL_CONTENT_URI
If you want to get a picture file, use MediaStore.Images.Media.EXTERNAL_CONTENT_URI
Android gets multimedia (including video, audio, picture) data