title: Input dialog box in a fragment
body: <p>I was trying to call input Dialog on a fragment which has a button (for simplicity) and dialog box has an Edittext field to enter the text like this :</p>
  
  <pre><code>public class CreateDayFragment extends Fragment {
  
  public CreateDayFragment(){
  }
  private Button button;![enter image description here][1]
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
      View rootView = inflater.inflate(R.layout.createday_main, container, false);
      button = (Button) getView().findViewById(R.id.createDayButton); 
      button.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              showInputDialog();
          }
      });
      return rootView;
  }
  protected void showInputDialog() {
      LayoutInflater layoutInflater = LayoutInflater.from(CreateDayFragment.this.getActivity());
      View promptView = layoutInflater.inflate(R.layout.createday_dialog, null);
      AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
              CreateDayFragment.this.getActivity());
      alertDialogBuilder.setView(promptView);
      final EditText editText = (EditText) promptView
              .findViewById(R.id.lectureDetailsEditText);
      alertDialogBuilder
              .setCancelable(false)
              .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int id) {
                      Toast.makeText(getActivity().getApplicationContext(),"OK CLICKED",1000).show();
                  }
              })
              .setNegativeButton("Cancel",
                      new DialogInterface.OnClickListener() {
                          public void onClick(DialogInterface dialog, int id) {
                              dialog.cancel();
                          }
                      });
  
      AlertDialog alert = alertDialogBuilder.create();
      alert.show();
  }
  } 
  </code></pre>
  
  <p>But this is not working .Please help as am not able to find out issues with this.</p>
  
  <blockquote>
    <p>11-04 08:43:54.800: E/AndroidRuntime(10568): FATAL EXCEPTION: main
    11-04 08:43:54.800: E/AndroidRuntime(10568): Process: com.example.loginphase, PID: 10568
    11-04 08:43:54.800: E/AndroidRuntime(10568): java.lang.NullPointerException
    11-04 08:43:54.800: E/AndroidRuntime(10568):    at com.example.loginphase.CreateDayFragment.onCreateView(CreateDayFragment.java:26)
    11-04 08:43:54.800: E/AndroidRuntime(10568):    at android.app.Fragment.performCreateView(Fragment.java:1700)
    11-04 08:43:54.800: E/AndroidRuntime(10568):    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:890)
    11-04 08:43:54.800: E/AndroidRuntime(10568):    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
    11-04 08:43:54.800: E/AndroidRuntime(10568):    at android.app.BackStackRecord.run(BackStackRecord.java:684)
    11-04 08:43:54.800: E/AndroidRuntime(10568):    at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1447)
    11-04 08:43:54.800: E/AndroidRuntime(10568):    at android.app.FragmentManagerImpl$1.run(FragmentManager.java:443)
    11-04 08:43:54.800: E/AndroidRuntime(10568):    at android.os.Handler.handleCallback(Handler.java:733)
    11-04 08:43:54.800: E/AndroidRuntime(10568):    at android.os.Handler.dispatchMessage(Handler.java:95)
    11-04 08:43:54.800: E/AndroidRuntime(10568):    at android.os.Looper.loop(Looper.java:136)
    11-04 08:43:54.800: E/AndroidRuntime(10568):    at android.app.ActivityThread.main(ActivityThread.java:5021)
    11-04 08:43:54.800: E/AndroidRuntime(10568):    at java.lang.reflect.Method.invokeNative(Native Method)
    11-04 08:43:54.800: E/AndroidRuntime(10568):    at java.lang.reflect.Method.invoke(Method.java:515)
    11-04 08:43:54.800: E/AndroidRuntime(10568):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
    11-04 08:43:54.800: E/AndroidRuntime(10568):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
    11-04 08:43:54.800: E/AndroidRuntime(10568):    at dalvik.system.NativeStart.main(Native Method)</p>
  </blockquote>