title: how to setMessage dialog with EditText Android
body: <p>I want to create dialog for looping dialog and view edittext into dialog.</p>
  
  <ol>
  <li>when activity start, dialog show to looping dialog no.1</li>
  <li>dialog looping = no.1 input user</li>
  <li>dialog looping to for show input dialog no.3 </li>
  </ol>
  
  <p>My error log :</p>
  
  <pre><code>1-29 14:54:23.314: E/AndroidRuntime(1099): FATAL EXCEPTION: main
  01-29 14:54:23.314: E/AndroidRuntime(1099): java.lang.NullPointerException
  01-29 14:54:23.314: E/AndroidRuntime(1099):     at com.example.dialog_looping.MainActivity$dialog$1.onClick(MainActivity.java:44)
  01-29 14:54:23.314: E/AndroidRuntime(1099):     at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:159)
  01-29 14:54:23.314: E/AndroidRuntime(1099):     at android.os.Handler.dispatchMessage(Handler.java:99)
  01-29 14:54:23.314: E/AndroidRuntime(1099):     at android.os.Looper.loop(Looper.java:123)
  01-29 14:54:23.314: E/AndroidRuntime(1099):     at android.app.ActivityThread.main(ActivityThread.java:3683)
  01-29 14:54:23.314: E/AndroidRuntime(1099):     at java.lang.reflect.Method.invokeNative(Native Method)
  01-29 14:54:23.314: E/AndroidRuntime(1099):     at java.lang.reflect.Method.invoke(Method.java:507)
  01-29 14:54:23.314: E/AndroidRuntime(1099):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
  01-29 14:54:23.314: E/AndroidRuntime(1099):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
  01-29 14:54:23.314: E/AndroidRuntime(1099):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>My full code of app :</p>
  
  <pre><code>package com.example.dialog_looping;
  
  import android.os.Bundle;
  import android.app.Activity;
  import android.app.AlertDialog;
  import android.content.Context;
  import android.content.DialogInterface;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.widget.EditText;
  import android.widget.TextView;
  
  public class MainActivity extends Activity {
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          //setContentView(R.layout.activity_main);
          setContentView(new dialog(this));
      }
      public class dialog extends View {
  
          public dialog(Context context) {
              super(context);
  
  
              //this.setNama(name.getText().toString());
              LayoutInflater inflater = (MainActivity.this).getLayoutInflater();
              new AlertDialog.Builder(MainActivity.this)
              .setIcon(R.drawable.ic_launcher)
              .setTitle("Input Your Name")
              .setView(inflater.inflate(R.layout.dialoginputname, null))
              .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int whichButton) {
                  EditText name;
                  name = (EditText)findViewById(R.id.name);
                  //String a = name.setText(name.getText().toString());
                  //int z = Integer.valueOf(a);
                     new AlertDialog.Builder(MainActivity.this)
                    .setTitle("YOur Name Is")
                    .setMessage(name.getText().toString())
                    .setNeutralButton("Close", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dlg, int sumthin) {
                    finish();
                    }})
                    .show();
               }
                })
                .setNegativeButton("cancel", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
  
                   finish();
                 }
                 })
                  .show();
                  }
  
          protected CharSequence nama() {
              // TODO Auto-generated method stub
              return null;
          }
              };
  
  
      }
  </code></pre>