title: Fragment must be a public static class to be properly recreated from instance state
body: <p>After updating to the latest support repository, </p>
  
  <pre><code>compile 'com.android.support:appcompat-v7:24.2.0'
  compile 'com.android.support:design:24.2.0'
  compile 'com.android.support:percent:24.2.0'
  compile 'com.android.support:recyclerview-v7:24.2.0'
  </code></pre>
  
  <p>I'm getting the weird exception.</p>
  
  <pre><code>java.lang.IllegalStateException: Fragment null must be a public static class to be  properly recreated from instance state.
  at android.support.v4.app.BackStackRecord.doAddOp(BackStackRecord.java:435)
  at android.support.v4.app.BackStackRecord.add(BackStackRecord.java:414)
  at android.support.v4.app.DialogFragment.show(DialogFragment.java:154)
  at com.androidapp.base.BaseActivity.showDialogFragment(BaseActivity.java:78)
  at com.androidapp.MainActivity.showNewDialog(MainActivity.java:304)
  at com.androidapp.MainActivity$6.onClick(MainActivity.java:228)
  </code></pre>
  
  <p>In my <strong>BaseActivity</strong> class, I've created a re-usable fragment which can be used in activity class that extends the <strong>BaseActivty</strong></p>
  
  <pre><code>public void showDialogFragment(DialogFragment newFragment) {
          FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
          Fragment prev = getSupportFragmentManager().findFragmentByTag("dialog");
          if (prev != null) {
              ft.remove(prev);
          }
          ft.addToBackStack("dialog");
          newFragment.show(ft, "dialog");
      }
  </code></pre>
  
  <p>Back to the <strong>MainActivty</strong> I've used the fragment like this,</p>
  
  <pre><code>public class MainActivity extends BaseActivity {
  
      @SuppressLint("ValidFragment")
          public void showNewDialog(int type, String title, String message) {
              final DialogNew dialog = new DialogNew() {
                  @Override
                  public void success(boolean isLandscape) {
                      .......
                  }
  
                  @Override
                  public void cancel() {
  
                  }
              };
              dialog.setArgs(title, message);
              super.showDialogFragment(dialog);
          }
  }
  </code></pre>
  
  <p>The <strong>DialogNew</strong> class is below,</p>
  
  <pre><code>public abstract class DialogNew extends DialogFragment {
  
      private View rootView;
  
      private String title;
      private String message;
  
      public void setArgs(String title, String message) {
          Bundle args = new Bundle();
          args.putString("title", title);
          args.putString("message", message);
          setArguments(args);
      }
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setStyle(STYLE_NO_TITLE, 0);
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
          rootView = inflater.inflate(R.layout.fragment_new_dialog, container, false);
  
          init();
          setListeners();
  
          return rootView;
      }
  
      public abstract void success(boolean isLandscape);
  
      public abstract void cancel();
  }
  </code></pre>
  
  <p>PS: The same code works with older support repository. </p>