Android Video Listing from local device?
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.
精彩评论