【发布时间】:2013-12-31 12:45:42
【问题描述】:
下面的代码不起作用,应用程序在启动时关闭并出现“不幸...”错误。
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scan_media_store_list_view);
vedio_list = (ListView) findViewById(R.id.vedio_list);
Uri contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
String[] projection = { MediaStore.Video.VideoColumns.DISPLAY_NAME};
cursor = getContentResolver().query(contentUri, projection, null, null, null);
title_index = cursor.getColumnIndexOrThrow(MediaStore.Video.VideoColumns.TITLE);
al = new ArrayList<String>();
showList();
}
private void showList() {
while(cursor.moveToNext())
{
String title = cursor.getString(title_index);
al.add(0 , title);
aa.notifyDataSetChanged();
}
cursor.close();
}
我做错了什么?
【问题讨论】:
-
请张贴logcat
-
什么是“不幸的错误”??????
标签: android listview android-contentprovider mediastore