java - Getting custom object on click from ListView -
i'm displaying listview filled custom listadapter, called lazyadapter, code comes here : http://www.androidhive.info/2012/02/android-custom-listview-with-image-and-text/. lazyadapter uses custom objects "eventdata". managed display list wanted, i'd clicked object. found on other questions (here, here, , there), , wrote code:
private onitemclicklistener meventclicklistener = new onitemclicklistener() { @override public void onitemclick(adapterview<?> av, view v, int arg2, long arg3) { eventdata selectedevent = (eventdata) eventslistview.getitematposition(arg2); };
however, cast error @ execution.
05-14 17:10:46.718: e/androidruntime(3863): java.lang.classcastexception: java.lang.integer
i tried similar solution:
eventdata selectedevent = (eventdata) av.getitematposition(arg2);
i got same cast error. don't know how can object eventdata in other way.
thanks help!
in custom list adapter return integer in getitem();
receive classcastexception
meventdata
list supplied customlistview
arraylist<eventdata> meventdata; @override public object getitem(int position) { return meventdata.get(position); }
Comments
Post a Comment