Normally, from an Activity
I could invoke an object that extends DialogFragment
and implements DialogInterface.OnClickListener()
.
Then if I wanted to, from that Dialog
, invoke a method in the parent activity, I could do ((NameOfParentActivity)getActivity()).nameOfMethod();
But now I am invoking such an object from a Fragment
(specifically, a page of a ViewPager
) instead of an Activity
.
I'm not exactly sure what to change to get the method-calling line to work. In other words I am trying to call a method from the Fragment
class, while inside its DialogFragment
object.
Edit: OnClick()
code from my Adapter
class:
public void onClick(View v) {
DeleteGameBoardDialogFragment dialogFragment = new DeleteGameBoardDialogFragment();
Bundle args = new Bundle();
args.putString(TabFragmentGameBoard.GAMEBOARD_DIALOG_TAG, mGameBoards.get(position).getGameBoardName());
dialogFragment.setArguments(args);
dialogFragment.show(((Activity) mContext).getFragmentManager(), "");
}