package com.ghostflying.portalwaitinglist.fragment; import android.app.Activity; import android.app.DialogFragment; import android.app.Fragment; /** * A simple {@link Fragment} subclass. * It is designed for offer a common interface and method for * the alert fragments used in this app. */ public abstract class BaseAlertDialogFragment extends DialogFragment { protected OnFragmentInteractionListener mListener; @Override public void onAttach(Activity activity) { super.onAttach(activity); try { mListener = (OnFragmentInteractionListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnFragmentInteractionListener"); } } @Override public void onDetach() { super.onDetach(); mListener = null; } /** * This interface must be implemented by activities that contain this * fragment to allow an interaction in this fragment to be communicated * to the activity and potentially other fragments contained in that * activity. * <p/> * See the Android Training lesson <a href= * "http://developer.android.com/training/basics/fragments/communicating.html" * >Communicating with Other Fragments</a> for more information. */ public interface OnFragmentInteractionListener { public void onPositiveButtonClick(int value, int title); public void onNegativeButtonClick(int value, int title); } }