"该方法setListAdapter(ArrayAdapter)是未定义的类型,来创建" [英] "The method setListAdapter(ArrayAdapter) is undefined for the type create"

查看:189
本文介绍了"该方法setListAdapter(ArrayAdapter)是未定义的类型,来创建"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我完全新的Java和放大器; Android的,所以我试图找到从安卓和功放有效样本;数据库。我发现这个博客有一个项目:

I am completely new to java & android, so I tried to find useful samples from android & databases. I found this blog with a project:

http://saigeethamn.blogspot.com/2009/10/android-developer-tutorial-part-12.html

我跑的项目,它工作正常,但我试图创建一个新的项目,以复制和;贴code在里面,这是不工作:(

I ran the project and it works fine, but I was trying to create a new project to copy & paste the code in it and this is not working :(

我有一个问题,在这条线:

I had a problem on this line:

this.setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,results));

这是我的错误:

该方法setListAdapter(ArrayAdapter)是未定义的类型,来创建

The method setListAdapter(ArrayAdapter) is undefined for the type create

它看起来像在C#中的方法,但我可以找到它的原始项目。

It looks like a method in C#, but I can find it in the original project.

在哪里我犯了一个错误?

Where did I make a mistake?

推荐答案

当你调用 this.setListAdapter 这必须扩展 ListActivity 可能是你刚才类扩展活动

When you call this.setListAdapter this must extend ListActivity probably you class just extends Activity.

这篇关于&QUOT;该方法setListAdapter(ArrayAdapter)是未定义的类型,来创建&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆