开发者

Android Video Listing from local device?

开发者 https://www.devze.com 2023-02-15 02:41 出处:网络
I use the Managed Query to fetch the list of information regarding video stored in local device. The code i used for that is shown below,

I use the Managed Query to fetch the list of information regarding video stored in local device.

The code i used for that is shown below,

System.gc();
String[] proj = { MediaStore.Video开发者_JAVA百科.Media._ID,
MediaStore.Video.Media.DATA,
MediaStore.Video.Media.DISPLAY_NAME,
MediaStore.Video.Media.SIZE,
MediaStore.Video.Media.DATE_ADDED,
MediaStore.Video.Media.DURATION
};



videocursor = managedQuery(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
proj, null, null, null);

It will show only the Video stored under path /sdcard/DCIM/camera, insted of that i need to list the video from specific folder,for that i use the following code

Uri test=Uri.parse("/sdcard/video");

videocursor = managedQuery(test,proj, null, null, null);

but it will show an error.Any provide the solution to parse and fetch the video from particular folder to list the video.

03-07 20:28:16.226: ERROR/AndroidRuntime(4969): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cpt.ViddyGo/com.cpt.ViddyGo.LocalVideolist}: java.lang.NullPointerException
03-07 20:28:16.226: ERROR/AndroidRuntime(4969): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2542)
03-07 20:28:16.226: ERROR/AndroidRuntime(4969): at android.app.ActivityThread.startActivityNow(ActivityThread.java:2381) 


I believe that it isn't possible to query media files from another folder.

0

精彩评论

暂无评论...
验证码 换一张
取 消