毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> 移动平台 >> 正文

用ContentResolver取不到MediaStore里的内容

更新时间:2013-5-18:  来源:毕业论文

用ContentResolver取不到MediaStore里的内容

ContentResolver cr =this.getContentResolver();                
                Cursor tempCur = cr.query(
                                MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
                                /*new String[]{ 毕业论文 
                                                MediaStore.Audio.Media._ID, //int
                                                MediaStore.Audio.Media.DATA, //String 
                                                MediaStore.Audio.Media.DISPLAY_NAME, //String
                                                MediaStore.Audio.Media.MIME_TYPE //String
                                        }*/
                                null,//无论取null还是上边的数组都是一样的
                                null, null, MediaStore.Audio.Media.DEFAULT_SORT_ORDER); //order取null也是一样的
                  
                  
                if(tempCur!=null){
                        if(D)Log.d(TAG,"Cursor.getCount in Audio"+tempCur.getCount());
                }else{
                        if(D)Log.d(TAG,"Cursor.getCount in Audio is NULL");
                }

manifest 权限 :


XML/HTML code?12 <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>


在我自己的手机上调试 moto defy+ (因为虚拟机里木有多媒体文件...懒得弄...)
手机里有一堆歌...

catlog:
06-27 23:29:38.139: D/Puzzle_Config(16872): Cursor.getCount in Audio is NULL


是不是URI不对呢?

截取log不全~     打印cr和tempCur是否为null

例如
MediaStore.Audio.Media.DATA= “data”
MediaStore.Audio.Media.DISPLAY_NAME=“displayName”
MediaStore.Audio.Media.MIME_TYPE=“mimeType”

/*new String[]{
                                                MediaStore.Audio.Media._ID, //int
                                                MediaStore.Audio.Media.DATA, //String
                                                MediaStore.Audio.Media.DISPLAY_NAME, //String
                                                MediaStore.Audio.Media.MIME_TYPE //String
                                        }*/

修改成new String[]{
"_id","data,"displayName","mimeType"
}

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。