Problem getting Uri Information from Various Sources

All your problems with Audio, Video and Images.

Problem getting Uri Information from Various Sources

Postby Matt M » Tue Jun 15, 2010 10:16 pm

Hello,

I have a method to get the title of a song on the sd card selected by the user

public String getTitle(Uri uri)
{
String[] projection = {MediaStore.MediaColumns.TITLE};
Cursor cursor = managedQuery(uri, projection, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.TITLE);
cursor.moveToFirst();
return cursor.getString(column_index);
}

When selecting the song the user is presented the option of which program to select the song with. When using the built in "Select music track" it works fine, but when another program is selected (for example, Astro File Manager) there is a null pointer exception at Cursor cursor = managedQuery.

What gets me is that the Uri is valid, calling uri.getPath() gives the correct path to the file.

Why does the built in "Select music track" Uri return apparently more data than others??

Thank you!

Matt M.
User avatar
Matt M
Developer
Developer
 
Posts: 30
Joined: Tue Apr 27, 2010 7:35 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 12 guests