title: Fragment null must be a public static class to be properly recreated from instance state
body: <p>I am not able to figure out why my app crashes when getSupportFragmentManager() is called.I have used similar code in other apps to create alert dialogs without any issues.please help!</p>
  
  <pre><code>DialogFragment df = new DialogFragment(){
  
          @NonNull
          @Override
          public Dialog onCreateDialog(Bundle savedInstanceState) {
              AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
              View view = getActivity().getLayoutInflater().inflate(R.layout.addincome,null);
              builder.setView(view);
              //capture
              final EditText amountEditText=(EditText)view.findViewById(R.id.edit_amount);
              final EditText descriptionEditText=(EditText)view.findViewById(R.id.edit_description);
              builder.setNegativeButton(android.R.string.cancel,null);
              builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                      newIncome.setAmount(Double.parseDouble(amountEditText.getText().toString()));
                      newIncome.setDescription(descriptionEditText.getText().toString());
                      user.incomes.add(newIncome);
                      HashMap&lt;String,User&gt; modified = new HashMap&lt;&gt;();
                      modified.put(uid,user);
                      rootref.setValue(modified);
                  }
              });
              return builder.create();
          }
      };
      df.show(getSupportFragmentManager(),"addIncome");
  </code></pre>