android - Show fragment after calling dragndrop -


in app fragment(first fragment) user can press on item , app show fragment list(second fragment), user can drop caught item. code:

 public void startdragndrop(){       showfragmentwithlist();       jsonobject object = new jsonobject();       object.put(constants.param_id, getid());       clipdata data = clipdata.newplaintext("", object.tostring());       view.dragshadowbuilder shadowbuilder = new view.dragshadowbuilder(mmainlayout);       mmainlayout.startdrag(data, shadowbuilder, mmainlayout, 0);  } 

and when second fragment catches action_drop close himself. , works well, if user remove finger faster method finish work, dragndrop won't start , second fragment won't receive dragndrop event, result new fragment won't disappear.

i tried fix via setting dragndrop listener @ first fragment , when catch action_drag_started call showfragmentwithlist() , fragment show. faced of new problem, view.ondraglistener doesn't work views inside of second fragment. can me problem?

you should start drag-n-drop action prior showing second fragment, not other way around. natural order of events. way won't end in situation when second fragment has been shown actual drag-n-drop hasn't started yet.

it's hard tell question root of problem suggest trying use ui handler instead of calling methods directly. way events go ui message queue , thus, dispatched after system events such onstart(), onresume() , forth. might fix problem of not receiving events in second fragment.

also please make sure first fragment doesn't "steal" drag events second fragment. maybe it's first fragment receives action_drop , that's why second 1 doesn't. hope helps.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -