DialogFragment getArguments giving NPE
<p>Hi I am writing a dialog fragment and trying to pass in some data using getArguments and setArguments but while retrieving the data using getArguments I get an NPE. </p>

<pre><code>public class EditNameDialog extends DialogFragment{


public static EditNameDialog newInstance(int type){

    EditNameDialog thedialog=new EditNameDialog();
    Bundle bundle=new Bundle();
    Log.v("typ",type+"");//--&gt;logs fine here
    bundle.putInt("mytype", type);
    thedialog.setArguments(bundle);
    return thedialog;

}



public Dialog onCreateDialog(Bundle icic){

    String ok="Play";
 //I get a NPE here in the below line
    switch(getArguments().getInt("mytype")){ 

    case 1:
    case 2:
        ok="Play";
        break;
    case 3:
        ok="Show";
        break;
    case 4:
        ok="Show";
        break;

    }
    //show alert dialog etc etc here

}

 }
</code></pre>

<p>Can someone please look at this and tell me what would am I missing here.</p>

<p>Edit:-
This is how i call the dialogfragment:-</p>

<pre><code> DialogFragment newFragment = EditNameDialog.newInstance(1);
 newFragment.show(getSupportFragmentManager(), "mydialog");
</code></pre>

<p>The LogCat looks like below:-</p>

<pre><code>01-14 12:52:58.557: E/AndroidRuntime(17271): FATAL EXCEPTION: main
01-14 12:52:58.557: E/AndroidRuntime(17271): java.lang.NullPointerException
01-14 12:52:58.557: E/AndroidRuntime(17271):    at com.civil.dialogs.EditNameDialog.onCreateDialog(EditNameDialog.java:79)
01-14 12:52:58.557: E/AndroidRuntime(17271):    at android.support.v4.app.DialogFragment.getLayoutInflater(DialogFragment.java:295)
01-14 12:52:58.557: E/AndroidRuntime(17271):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
01-14 12:52:58.557: E/AndroidRuntime(17271):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
01-14 12:52:58.557: E/AndroidRuntime(17271):    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
01-14 12:52:58.557: E/AndroidRuntime(17271):    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
01-14 12:52:58.557: E/AndroidRuntime(17271):    at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:429)
01-14 12:52:58.557: E/AndroidRuntime(17271):    at android.os.Handler.handleCallback(Handler.java:725)
01-14 12:52:58.557: E/AndroidRuntime(17271):    at android.os.Handler.dispatchMessage(Handler.java:92)
01-14 12:52:58.557: E/AndroidRuntime(17271):    at android.os.Looper.loop(Looper.java:137)
01-14 12:52:58.557: E/AndroidRuntime(17271):    at android.app.ActivityThread.main(ActivityThread.java:5039)
01-14 12:52:58.557: E/AndroidRuntime(17271):    at java.lang.reflect.Method.invokeNative(Native Method)
01-14 12:52:58.557: E/AndroidRuntime(17271):    at java.lang.reflect.Method.invoke(Method.java:511)
01-14 12:52:58.557: E/AndroidRuntime(17271):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-14 12:52:58.557: E/AndroidRuntime(17271):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-14 12:52:58.557: E/AndroidRuntime(17271):    at dalvik.system.NativeStart.main(Native Method)
</code></pre>
