title: Incompatible types of fragment
body: <p>Hi I have small app in android where Im using fragments with navigation drawer for menu. But now I want show in my fragments dialog popup window when user click on something and there I get these errors:</p>
  
  <p><strong>MainActivity:</strong></p>
  
  <pre><code>private void displayView(int position) {
      // update the main content by replacing fragments
      Fragment fragment = null;
      switch (position) {
          case 0:
              fragment = new HomeFragment();
              break;
          case 1:
              fragment = new FindPeopleFragment();
              break;
          default:
              break;
      }
  
      if (fragment != null) {
          FragmentManager fragmentManager = getFragmentManager();
          fragmentManager.beginTransaction()
                  .replace(R.id.frame_container, fragment).commit();
  
          // update selected item and title, then close the drawer
          mDrawerList.setItemChecked(position, true);
          mDrawerList.setSelection(position);
          setTitle(navMenuTitles[position]);
          mDrawerLayout.closeDrawer(mDrawerList);
      } else {
          // error in creating fragment
          Log.e("MainActivity", "Error in creating fragment");
      }
  }
  </code></pre>
  
  <p>First error I get on <em>fragment = new HomeFragment();</em> <strong>>>incompatible types</strong>.</p>
  
  <p>Second error on HomeFragment at <strong>onCreateView method</strong> >> method does not override or implement a method from a supertype</p>
  
  <p><strong>HomeFragment:</strong></p>
  
  <pre><code>public class HomeFragment extends FragmentActivity {
  
  public HomeFragment(){}
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
  
      View rootView = inflater.inflate(R.layout.fragment_home, container, false);
      final RelativeLayout rlPolievkaShowDialog=(RelativeLayout)rootView.findViewById(R.id.rlPolievkaButton);
      rlPolievkaShowDialog.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
          }
  
      });
      return rootView;
  }
  
  private void showDialog() {
      DialogFragment newFragment = DialogFragmentAlergeny.newInstance();
      newFragment.show(getSupportFragmentManager(), "dialog");
  }
  </code></pre>
  
  <p>}</p>
  
  <p><strong>DialogFragmentAlergeny:</strong></p>
  
  <pre><code>public class DialogFragmentAlergeny extends DialogFragment {
  
  public static DialogFragmentAlergeny newInstance() {
      DialogFragmentAlergeny frag = new DialogFragmentAlergeny();
      return frag;
  }
  
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
      AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());
      View view = getActivity().getLayoutInflater().inflate(R.layout.alergeny_dialog, null);
      alertDialogBuilder.setView(view);
      alertDialogBuilder.setTitle(getString(R.string.alergeny_dialog_title));
      alertDialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
      dialog.dismiss();
          }
      });
      return alertDialogBuilder.create();
  }
  </code></pre>
  
  <p>}</p>