【发布时间】:2010-01-22 17:02:04
【问题描述】:
我很好奇是否有一种方法可以将多个 db 列绑定到资源。我需要将更多信息绑定到 R.id.secondLine 然后只是难度列。但我不确定该怎么做?我目前正在继承 SimpleCursorAdapter。我应该继承另一个适配器吗?如果是,我该怎么办?
Cursor activityHikes = mDbAdapter.fetchAllHikes(false);
startManagingCursor(activityHikes);
String[] from = new String[] { ActivityHike.NAME, ActivityHike.DIFFICULTY, ActivityHike.THUMBNAIL};
int[] to = new int[]{R.id.mainText, R.id.secondLine, R.id.icon};
HikeAdapter hikes = new HikeAdapter(this, R.layout.hike_row, activityHikes, from, to);
ListView list = (ListView) this.findViewById(R.id.hikelist);
list.setAdapter(hikes);
谢谢
对于遇到同样问题的任何人,此链接也对我有很大帮助。 Android: Binding data from a database to a CheckBox in a ListView?
【问题讨论】: