How to display AlertDialog in a Fragment?
Replace context with getActivity(). The ApplicationContext should not be used for tasks such as creating Dialogs. As you are in a fragment you can instead get the Activity-Context simply by calling the Fragments getActivity() method.