title: android.support.v4.app.FragmentManager.beginTransaction()' on a null object reference
body: <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
                    Process: websters.smartindiaserviceapp, PID: 3320
                    java.lang.RuntimeException: Unable to start activity ComponentInfo{websters.smartindiaserviceapp/websters.smartindiaserviceapp.Activities.WelcomeActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.support.v4.app.FragmentTransaction android.support.v4.app.FragmentManager.beginTransaction()' on a null object reference
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                        at android.app.ActivityThread.-wrap11(ActivityThread.java)
                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                        at android.os.Handler.dispatchMessage(Handler.java:102)
                        at android.os.Looper.loop(Looper.java:148)
                        at android.app.ActivityThread.main(ActivityThread.java:5417)
                        at java.lang.reflect.Method.invoke(Native Method)
                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.support.v4.app.FragmentTransaction android.support.v4.app.FragmentManager.beginTransaction()' on a null object reference
                        at android.support.v4.app.DialogFragment.dismissInternal(DialogFragment.java:200)
                        at android.support.v4.app.DialogFragment.dismiss(DialogFragment.java:171)
                        at websters.smartindiaserviceapp.Activities.WelcomeActivity.onCreate(WelcomeActivity.java:51)
                        at android.app.Activity.performCreate(Activity.java:6237)
                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                        at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                        at android.os.Handler.dispatchMessage(Handler.java:102) 
                        at android.os.Looper.loop(Looper.java:148) 
                        at android.app.ActivityThread.main(ActivityThread.java:5417) 
                        at java.lang.reflect.Method.invoke(Native Method) 
                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
  </code></pre>
  
  <p>this Exception i am getting when i try to dismiss custom dialog in actvtiy</p>
  
  <pre><code>public class CustomDialog extends DialogFragment {
  
     public static CustomDialog newInstance() {
          return new CustomDialog();
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          View v = inflater.inflate(R.layout.dialog, container, false);
          Glide.with(this).load(R.drawable.loader).placeholder(R.drawable.loader)
                  //.dontAnimate()
                  .into((ImageView) v.findViewById(R.id.progress));
          getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
          getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
  
          if (getDialog() == null)
              super.setShowsDialog (false);
          return v;
      }
  
  }
  </code></pre>
  
  <p>this is my class for custom dialog .</p>
  
  <p>i am showing dialog using this code:
  <code>CustomDialog.newInstance().show(getSupportFragmentManager(),"Dialog");</code> working fine displaying dialog </p>
  
  <p>and try to dismiss 
  using  <code>CustomDialog.newInstance().dismiss();</code> this code but here i am getting Exception please tell me where am doing wrong how to dismiss give dialog.</p>