Michael Mossman
- Forum posts: 1
Oct 30, 2012, 11:51:11 AM via Website
Oct 30, 2012 11:51:11 AM via Website
I have been following a tutorial on ListView and the following code gives errors. I have searched all the forums I can find but I keep coming up with the same recommended code. Maybe all the forums are quoting old versions and perhaps Android has moved on.
Anyway, here is the code and the error message :-
getListView().setOnItemClickListener(new OnItemClickListener()
{
//@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id)
{
// TODO Sort out error and add function code
}
});
Error message :-
Multiple markers at this line
-The method setOnItemClickListener(AdapterView.OnItemClickListener in the type AdapterView <ListAdapter> is not applicable for the arguments (new OnItemClickListener(){})
-OnItemClickListener cannot be resolved to a type
Any offers ? Thanks, Mike
Anyway, here is the code and the error message :-
getListView().setOnItemClickListener(new OnItemClickListener()
{
//@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id)
{
// TODO Sort out error and add function code
}
});
Error message :-
Multiple markers at this line
-The method setOnItemClickListener(AdapterView.OnItemClickListener in the type AdapterView <ListAdapter> is not applicable for the arguments (new OnItemClickListener(){})
-OnItemClickListener cannot be resolved to a type
Any offers ? Thanks, Mike
— modified on Oct 30, 2012, 11:52:41 AM
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.