Android application crashs when i drop item into gridview -
i try drag , drop item between grid view, item correctly dragged when in action application crashs. code
case dragevent.action_drop: passobject passobj = (passobject)event.getlocalstate(); view view = passobj.view; artifact passeditem = passobj.artifact; list<artifact> srclist = passobj.srclist; abslistview oldparent = (abslistview)view.getparent(); artifactadapter srcadapter = (artifactadapter) oldparent.getadapter(); linearlayoutabslistview newparent = (linearlayoutabslistview)v; artifactadapter destadapter = (artifactadapter)(newparent.abslistview.getadapter()); list<artifact> destlist = destadapter.getlist(); if(removeitemtolist(srclist, passeditem)){ additemtolist(destlist, passeditem); } srcadapter.notifydatasetchanged(); destadapter.notifydatasetchanged(); //smooth scroll bottom newparent.abslistview.smoothscrolltoposition(destadapter.getcount()-1); break; case dragevent.action_drag_ended: default: break;
the problem in line
artifactadapter destadapter = (artifactadapter)(newparent.abslistview.getadapter());
any appreciated !!
Comments
Post a Comment