Cursor getColumnIndex - Get the Index for a Column Name

Cursor getColumnIndex was added in API Level 1

** Use getColumnIndexOrThrow(String) instead, if you expect the column to exist. **
public abstract int getColumnIndex (String columnName)
Returns the zero-based index for the given column name, or -1 if the column doesn't exist. If you expect the column to exist use getColumnIndexOrThrow(String) instead, which will make the error more clear.
Parameters: columnName the name of the target column.
Returns: the zero-based column index for the given column name, or -1 if the column name does not exist.

1. Move the Cursor to the First Row of a Cursor named myCursor.

2. Add the below line right after if (myCursor.moveToFirst()) { where the // myCursor moved to the first record comment is located. This will save the contents of the Display name of an audio file to a string named myString

String myString = cursor.getString(cursor.getColumnIndex(android.provider.MediaStore.Audio.Media.DISPLAY_NAME));

3. Compile and run!

4. Other column names for MediaStore Audio files are listed here

Resources:
http://developer.android.com/reference/android/database/Cursor.html#getColumnIndex(java.lang.String)