我使用SimpleCursorAdapter向ListView显示信息。
adapter = new SimpleCursorAdapter(
this,
R.layout.item_music,
myCursor,
new String[]{
MediaStore.Audio.Media.ARTIST,
MediaStore.Audio.Media.ALBUM,
MediaStore.Audio.Media.TITLE,
MediaStore.Audio.Media._ID},
// To widget ids in the row layout...
new int[]{
R.id.item_artist,
R.id.item_album,
R.id.item_title,
R.id.item_action});
它有时会起作用,有时会因错误“列'_id'不存在而崩溃”。发生了什么事?
这是我的Logcat:
java.lang.IllegalArgumentException: column '_id' does not exist
at android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:303)
at android.support.v4.widget.CursorAdapter.swapCursor(CursorAdapter.java:344)
at android.support.v4.widget.SimpleCursorAdapter.swapCursor(SimpleCursorAdapter.java:326)
感谢您的帮助。
答案 0 :(得分:0)
每当您想要从angular.module('demo')
.controller('democtrl', ['$scope', function ($scope) {
$scope.selectedOption = "ip";
}]);
中选择内容并显示到select _id
时,您需要database
。
例如:
listView