Android : Pass data from FragmentDialog started in adapter to hosting fragment

on Sunday, October 12, 2014


Im having Fragment with Listview and adapter which is in separate file. Every item of ListView has its own button that opens a FragmentDialog. The problem I'm facing comes when I close the Dialog. I need to catch the information inside my fragment that dialog has been closed. I was trying to use a setTargetFragment but the problem is that I dont know how to reach the Fragments instance from inside the adapter. Here is example of what i tried:



HabbitStateChangeDialogFragment dialog =
HabbitStateChangeDialogFragment.newInstance( state, hm, currentDate.getTime());
dialog.listener = this;
dialog.setTargetFragment(??????, DayActivity.REQUEST_UPDATE);
dialog.show(((ActionBarActivity) getContext()).getSupportFragmentManager(), TAG_UPDATE);

0 comments:

Post a Comment