/** When creating, retrieve this instance's number from its arguments. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { SelectDateDialogFragment sd = (SelectDateDialogFragment) getSherlockActivity() .getSupportFragmentManager() .findFragmentByTag( "SelectDateDialog"); // "tag" is the string set as the tag for the dialog // when you show it if (sd != null) { // the dialog exists so update its listener sd.setListener(this); } } mNum = getArguments() != null ? getArguments().getInt("num") : 1; }
public void onFilterClicked(View v) { SelectDateDialogFragment dialog = SelectDateDialogFragment.newInstance(); dialog.setListener((SelectDateDialog) GraphCategories.GraphCategoriesFragment.this); dialog.show(getSherlockActivity().getSupportFragmentManager(), "SelectDateDialog"); }