解析Intent.getdata()得到的uri为String型的filePath

public String getRealPathFromURI(Uri contentUri) {
    String[] proj = {MediaStore.Audio.Media.DATA};
    Cursor cursor = managedQuery(contentUri, proj, null, null, null);
    int column_index = cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.DATA); 
    cursor.moveToFirst(); return cursor.getString(column_index);
}

你可能感兴趣的:(解析Intent.getdata()得到的uri为String型的filePath)