Reputation: 755
I have this code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ListView lv = (ListView) findViewById(R.id.lvResult);
ListAdapter listAdapter = new ListAdapter(Prueba.this, imageList, list1, list2);
lv.setAdapter(listAdapter);
}
And it gives an Error:
Cannot instantiate the type ListAdapter
In the same package, I have created a class called ListAdapter.java
with its code.
I don't know what that error means.
Upvotes: 2
Views: 7909
Reputation: 21909
ListAdapter is also a class in the android.widget package. It is possible that you are importing this, and this is trying to be instantiated rather than your local ListAdapter class.
Your options are:
import android.widget.ListAdapter;
or import android.widget.*;
from your code.com.mycompany.ListAdapter
)Upvotes: 11