1
我使用託管查詢來獲取存儲在本地設備中的視頻信息列表。從本地設備Android視頻列表?
我用的代碼如下所示,
System.gc();
String[] proj = { MediaStore.Video.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);
它會顯示只有在路徑/ SD卡/ DCIM /攝像機存儲的視頻,insted的的,我需要列出從特定文件夾中的視頻,爲此,我使用下面的代碼
Uri test=Uri.parse("/sdcard/video");
videocursor = managedQuery(test,proj, null, null, null);
,但它會顯示一個error.Any提供解決方案來分析和提取從特定文件夾中的視頻列表中選擇視頻。
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)
什麼是錯誤或logcat?接受你之前問題的答案。 –
03-07 20:28:16.226:錯誤/ AndroidRuntime(4969):java.lang.RuntimeException:無法啓動活動ComponentInfo {com.cpt.ViddyGo/com.cpt.ViddyGo.LocalVideolist}:java.lang.NullPointerException 03-07 20:28:16.226:錯誤/ 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) – Karthi