android中SimpleAdapter的问题

xiaodi88061671 2012-10-26 09:58:50
不知道为什么 代码提示说SimpleAdapter未定义
List<Schedule> schedules = mgr.query();
ArrayList<Map<String, String>> list = new ArrayList<Map<String, String>>();
for (Schedule schedule : schedules) {
HashMap<String, String> map = new HashMap<String, String>();
map.put("course_name", schedule.course_name);
map.put("course_teacher", schedule.course_teacher);
// map.put("info", schedule.age + " years old, " +
// schedule.info);
list.add(map);
}

SimpleAdapter adapter = new SimpleAdapter(this, list,
R.layout.list_view_select, new String[] {
"course_name", "course_teacher",
"course_address", "course_week", "start_time",
"end_time" }, new int[] { R.id.text1,
R.id.text2, R.id.text3, R.id.text4, R.id.text5,
R.id.text6 });
lv.setAdapter(adapter);



怎么解决呀?????????
...全文
196 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaodi88061671 2012-10-26
  • 打赏
  • 举报
回复
嘿嘿 解决了 多谢JKINGCL哈
SimpleAdapter(this, list,
把this改为"当前Activity名".this
  • 打赏
  • 举报
回复
你这个是对的嘛,要不你把全部代码贴出来呢!
我就把这个放到实例程序都是对的!晕死!还有你试一试重启eclipse,还有你的JDK版本和android版本你换一换呢?
xiaodi88061671 2012-10-26
  • 打赏
  • 举报
回复
又没人啦?
xiaodi88061671 2012-10-26
  • 打赏
  • 举报
回复
还不能运行呢 logcat还没有呢
SimpleAdapter adapter = new SimpleAdapter(this, list,
R.layout.list_view_select, new String[] {
"course_name", "course_teacher",
"course_address", "course_week", "start_time",
"end_time" }, new int[] { R.id.text1,
R.id.text2, R.id.text3, R.id.text4, R.id.text5,
R.id.text6 });
lv.setAdapter(adapter);
这段代码显示红标记了 红x提示是“no suggestions available” 指向的是 new后边的
SimpleAdapter(this, list,
R.layout.list_view_select, new String[] {
"course_name", "course_teacher",
"course_address", "course_week", "start_time",
"end_time" }, new int[] { R.id.text1,
R.id.text2, R.id.text3, R.id.text4, R.id.text5,
R.id.text6 });
不知道怎么回事
  • 打赏
  • 举报
回复
把你的错误信息贴出来啊!
xiaodi88061671 2012-10-26
  • 打赏
  • 举报
回复
别沉下去啊 Help!
xiaodi88061671 2012-10-26
  • 打赏
  • 举报
回复
是这个吧 import android.widget.SimpleAdapter;
有的
不简单de 2012-10-26
  • 打赏
  • 举报
回复
没有import吧

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧