“方法setListAdapter(ArrayAdapter)未定义类型create” [英] "The method setListAdapter(ArrayAdapter) is undefined for the type create"
问题描述
我是全新的java& android,所以我试图找到有用的样本从android&数据库。我发现这个博客有一个项目:
http://saigeethamn.blogspot.com/2009/10/android-developer-tutorial-part-12.html
我运行的项目,它的工作正常,但我试图创建一个新的项目复制&粘贴代码,这不工作:(
我在这一行有一个问题:
this.setListAdapter(new ArrayAdapter< String>(this,android.R.layout.simple_list_item_1,results));
这是我得到的错误:
setListAdapter(ArrayAdapter)方法未定义类型create
它看起来像一个C#中的方法,但我可以在原始项目中找到它。
$ b当你调用 this.setListAdapter
这必须扩展 ListActivity
可能你的类只是扩展 Activity
。
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
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));
This is the error I get:
The method setListAdapter(ArrayAdapter) is undefined for the type create
It looks like a method in C#, but I can find it in the original project.
Where did I make a mistake?
When you call this.setListAdapter
this must extend ListActivity
probably you class just extends Activity
.
这篇关于“方法setListAdapter(ArrayAdapter)未定义类型create”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!