To enable the developer to share data from one application with another, Android provides the android.content.ContentProvider class. This vastly simplifies the management of common data types, such as audio, video, images, and contact details, and also provides several built-in providers under the android.provider package.
In this exercise we will use the MediaStore provider to examine the audio files on our device's SD card. Make sure that the handset or emulator being used for this recipe has some MP3 files loaded onto the SD card, then start up a new Android project in Eclipse.
Starting with the
main.xml
file in theres/layout
folder, give the default TextView anandroid:id
oftext_view
and setandroid:text
to an empty string:android:id="@+id/text_view" android:text=""
In the main Java Activity code, inside the
onCreate()
method and after thesetContentView()
call, create and associate a TextView...