The Android system provides interfaces such as mediascanner, mediaprovider, and mediastore, as well as a set of database tables, which are provided to users through content providers. When a mobile phone is turned on or has SD card plugging or removal, the system will automatically scan the media files on the SD card and mobile phone memory, such as audio, video, and images, put the corresponding information in the defined database table. In this prog
This article is intended to retrieve the video in the SD card on the mobile phone, and then display the thumbnails, names, and other video information of the retrieved video on the ListView. Click each item to play the corresponding video.
Source code:
Layout file:
Activity_main:
List_item:
Code file:
MainActivity. java:
Package com. multimediademo13mediastore; import java. io. file; import java. util. arrayList; import android. app. activity; import a
.
2. Use the cursor object;
Method:
1, cursor c = Cr. getcontentresolver (). Query (Uri, projection, selection, selectionargs, sortorder)
The CR here is the previously obtained contextresolver object. In this way, the contextresolver object must be instantiated first.
So, can the instance come out directly? Yes ~
2, cursor c = context. getcontentresolver (). Query (Uri, projection, selection, selectionargs, sortorder)
You only need to use context. getcontextresolver () directly. There are no er
Mediastore is a multimedia database provided by the Android system. Multimedia Information in android can be extracted from this class. This mediastore includes all the information of the multimedia database, including audio, video, and image. Android encapsulates all the multimedia database interfaces, and all databases do not need to be created by themselves, you can directly call contentresolver to remov
At the request of netizens, I would like to tell you about the android multimedia database today. MediaStore is a multimedia database provided by the android system. Multimedia Information in android can be extracted from this class. This MediaStore includes all the information of the multimedia database, including audio, video, and image. android encapsulates all the multimedia database interfaces, and all
At the request of netizens, today we will talk about the multimedia database of Android. Mediastore This class is a multimedia database provided by the Android system, which can be extracted from the Android multimedia information. This mediastore includes all the information of the multimedia database, including audio, video and images, and Android encapsulates all of the multimedia database interfaces, al
Mediastore This class is a multimedia database provided by the Android system, which can be extracted from the Android multimedia information.This mediastore includes all the information of the multimedia database, including audio, video and images, and Android encapsulates all of the multimedia database interfaces, all of which are not created by themselves. Direct calls take advantage of Contentresolver t
The Android system provides interfaces such as Mediascanner,mediaprovider,mediastore, and provides a set of database tables that are available to users through content provider. When the cell phone boot or SD card Plug and other events occur, the system will automatically scan the SD card and cell phone memory of the media files, such as audio,video, pictures, etc., the corresponding information into a well-defined database table. In this program, we
(r.layout.activity_main); listview = (ListView) Findviewbyid (R.id.listview);/** * The list of columns obtained from the MediaStore.Video.Thumbnail query. */string[] Thumbcolumns = {mediastore.video.thumbnails.data,mediastore.video.thumbnails.video_id};/** * The list of columns obtained from the MediaStore.Video.Media query. */string[] Mediacolumns = {Mediastore.video.media._id,mediastore.video.Media.data, Mediastore.video.media.title,mediastore.video.media.mime_type};/** * All videos represent
Like image and audio, video information is also managed by mediastore in Android.
Each video corresponds to a thumbnail, which is usually the first frame of the image.
See the code below:
Package demo. camera;
the audio_meta table. Let's take a look at the definition of the audio View:
Create view audio as select * fromaudio_meta left Outer Join artists on audio_meta.artist_id = artists. artist_idleft Outer Join albums on audio_meta.album_id = albums. album_id;
Albums table: stores album information.
Artists table: Mainly stores information about singers. I will not repeat it here.
Other tables may be used less frequently and will not be described. If you are interested, you can study them on your ow
1. There are two ways to get a video Thumbnail (1) through the content provider (2) create a thumbnail manually
(1) The disadvantage is that you must update the media library to see the thumbnail of the latest video.
[Java]
Copy codeThe Code is as follows :/**
* @ Param context
* @ Param cr
* @ Param Videopath
* @ Return
*/
Public static Bitmap getVideoThumbnail (Context context, ContentResolver cr, String Videopath ){
ContentResolver testcr = context. getContentResolver ();
String [] projection
After running the Demo, a list of all the music files on your SD card is displayed, and you can click the list to select a song for playing.
Running effect:
Click download to display:
Then, click the song to call the system player to play the video.
Source code:
Activity_audio_browser.xml:
AudioBrowser. java:
Package com. multimediademo5customaudioplayer2; import java. io. file; import android. app. listActivity; import android. content. intent; import android. database.
How to add a menu for setting dual-card ringtones in android Music
1. Enable the scenario mode to set the feature of the dual-card ringtone: MTK_MULTISIM_ROINGTONE_SUPPORT, but the dual-card ringtone cannot be set in Music. To add "Us as SIM1/SIM2 ringtone" in Music"
1, string. xml, add the new string ringtone_as_sim1_menu and ringtone_as_sim2_menu:
Use as SIM1 ringtone
Use as SIM2 ringtone
2. TrackBrowserActivity. java:
1), add:
Import com. mediatek. telephony. SimInfoManager;
Im
Some time ago, I processed Android music file information. I checked online and found that the Android system provided mediascanner, mediaprovider, mediastore, and other interfaces and provided a set of database tables, share content to users through content provider. Description: [Android data is private] data can be shared through the content provider method. I have introduced this content provider in general, and the contentprovider introduction in
only to this application, or are they shared with other applications, such as photo albums or other media and community applications? Do you want these images and videos to be available after the application is uninstalled? See how the following "Save a media file" solves these problems.
Basic
The Android framework supports photo taking and video recording through the Camera API or the Camera Intent. The following are related classes:
Camera
This class is the main API that controls the device C
. adddatascheme ("file ");Scansdreceiver = new scansdreceiver ();Registerreceiver (scansdreceiver, intentfilter );Sendbroadcast (new intent (intent. action_media_mounted,Uri. parse ("file ://"+ Environment. getexternalstoragedirectory (). Getabsolutepath ())));}}
Send broadcast information by clicking the button, and then scan the audio information through the broadcast service.
The following is the broadcast service code:
Package com. ZTE. broadcastreceivermediascanner;
Import Android. App. ale
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.