Hello.
I get an error if I use this simple code:
import android.provider.MediaStore.Audio.Media;
// Save the name and description of an image in a ContentValues map.
ContentValues values = new ContentValues(3);
values.put(Media.DISPLAY_NAME, "road_trip_1");
values.put(Media.TITLE, "Day 1, trip to Los Angeles");
values.put(Media.MIME_TYPE, "audio/mp3");
// Add a new record without the bitmap, but with the values just set.
// insert() returns the URI of the new record.
Uri uri = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values);
The error I get is on the last code line:
Writing exception to parcel
java.lang.NullPointerException
at com.android.providers.media.MediaProvider.insertInternal(MediaProvider.java:1286)
at com.android.providers.media.MediaProvider.insert(MediaProvider.java:1193)
(...)
But, when I insert a new image entry instead of an audio entry I get no error!
(import android.provider.MediaStore.Images.Media; instead of android.provider.MediaStore.Audio.Media; would work, but I need to insert a audio file)



