many custom dialog with radioButton
<p>i have simple app using dialog for divided,subtraction,and etc with looping condition by operator</p>

<p>my error</p>

<pre><code>02-08 17:29:23.271: W/KeyCharacterMap(744): No keyboard for id 0
02-08 17:29:23.271: W/KeyCharacterMap(744): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
02-08 17:29:24.011: D/dalvikvm(744): GC_EXTERNAL_ALLOC freed 72K, 52% free 2611K/5379K, external 914K/1038K, paused 59ms
02-08 17:29:26.101: W/KeyCharacterMap(744): No keyboard for id 0
02-08 17:29:26.101: W/KeyCharacterMap(744): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
02-08 17:29:30.311: D/AndroidRuntime(744): Shutting down VM
02-08 17:29:30.311: W/dalvikvm(744): threadid=1: thread exiting with uncaught exception (group=0x40015560)
02-08 17:29:30.321: E/AndroidRuntime(744): FATAL EXCEPTION: main
02-08 17:29:30.321: E/AndroidRuntime(744): java.lang.NullPointerException
02-08 17:29:30.321: E/AndroidRuntime(744):  at com.example.dialog_looping.MainActivity$1$1$1.onClick(MainActivity.java:72)
02-08 17:29:30.321: E/AndroidRuntime(744):  at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:159)
02-08 17:29:30.321: E/AndroidRuntime(744):  at android.os.Handler.dispatchMessage(Handler.java:99)
02-08 17:29:30.321: E/AndroidRuntime(744):  at android.os.Looper.loop(Looper.java:123)
02-08 17:29:30.321: E/AndroidRuntime(744):  at android.app.ActivityThread.main(ActivityThread.java:3683)
02-08 17:29:30.321: E/AndroidRuntime(744):  at java.lang.reflect.Method.invokeNative(Native Method)
02-08 17:29:30.321: E/AndroidRuntime(744):  at java.lang.reflect.Method.invoke(Method.java:507)
02-08 17:29:30.321: E/AndroidRuntime(744):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-08 17:29:30.321: E/AndroidRuntime(744):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-08 17:29:30.321: E/AndroidRuntime(744):  at dalvik.system.NativeStart.main(Native Method)
02-08 17:34:30.490: I/Process(744): Sending signal. PID: 744 SIG: 9
</code></pre>

<p>this is my full code use dialog looping for subtraction,divided and etc....</p>

<pre><code>public class MainActivity extends Activity {
    int result=0,i;
    int [] arr;
    int indexArray = 0;
    String Oprtr;
    RadioGroup operator_mode;
    RadioButton rb;
    @Override  
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        final LayoutInflater inflater = this.getLayoutInflater();
        final View v=inflater.inflate(R.layout.dialoginput, null);

        operator_mode=(RadioGroup)findViewById(R.id.operator);


        //operator_mode.setOnClickListener(l)(null);

        new AlertDialog.Builder(MainActivity.this)
            .setIcon(R.drawable.ic_launcher)
            .setTitle("Total Operator")
            .setView(v)
            .setPositiveButton("Ok", new DialogInterface.OnClickListener() {

                 public void onClick(final DialogInterface dialog, int whichButton) {
                      EditText op = (EditText)v.findViewById(R.id.operator);
                      arr=new int [Integer.valueOf(op.getText().toString())+1];
                      for (i = 0;i&lt;arr.length;i++){


                            LayoutInflater inflater = MainActivity.this.getLayoutInflater();
                            final View v2=inflater.inflate(R.layout.input, null) ;

                            new AlertDialog.Builder(MainActivity.this)
                                .setIcon(R.drawable.ic_launcher)
                                .setTitle("number:")
                                .setView(v2)
                                .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dlg, int sumthin) {

                                        EditText number = (EditText)v2.findViewById(R.id.number);
                                        arr[indexArray]= Integer.valueOf(number.getText().toString());
                                        //Log.v ("aa",Integer.toString(arr[indexArray]));

                                        LayoutInflater inflater = MainActivity.this.getLayoutInflater();
                                        final View v3=inflater.inflate(R.layout.operator, null) ;

                                        new AlertDialog.Builder(MainActivity.this)
                                        .setIcon(R.drawable.ic_launcher)
                                        .setTitle("select Operator:")
                                        .setView(v3)
                                        .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                                            public void onClick(DialogInterface dlg, int sumthin) {
                                                sumthin = operator_mode.getCheckedRadioButtonId();
                                                rb = (RadioButton) findViewById(sumthin);
                                                switch(sumthin){
                                                case R.id.plus:
                                                    Oprtr = "+";
                                                    Log.v ("aa",Oprtr);
                                                    /*
                                                    if (indexArray==0){
                                                        result = arr[indexArray];
                                                        if (result&lt;0){
                                                            new AlertDialog.Builder(MainActivity.this)
                                                                .setTitle("Error")
                                                                .setMessage("result can't negative value")
                                                                .setNeutralButton("Close", new DialogInterface.OnClickListener() {
                                                                    public void onClick(DialogInterface dlg, int sumthin) {
                                                                        finish();
                                                                    }
                                                                })
                                                                .show();
                                                            } else if (result&gt;9999999){
                                                                new AlertDialog.Builder(MainActivity.this)
                                                                .setTitle("Error")
                                                                .setMessage("result can't &gt; 9999999")
                                                                .setNeutralButton("Close", new DialogInterface.OnClickListener() {
                                                                    public void onClick(DialogInterface dlg, int sumthin) {
                                                                        finish();
                                                                    }
                                                                })
                                                                .show();
                                                            }else {
                                                                new AlertDialog.Builder(MainActivity.this)
                                                                .setTitle("result")
                                                                .setMessage(Integer.toString(result))
                                                                .setNeutralButton("Close", new DialogInterface.OnClickListener() {
                                                                    public void onClick(DialogInterface dlg, int sumthin) {
                                                                    }
                                                                })
                                                                .show();
                                                            }
                                                    } else {
                                                            result = result + arr[indexArray];
                                                            if (result&lt;0){
                                                            new AlertDialog.Builder(MainActivity.this)
                                                                .setTitle("Error")
                                                                .setMessage("result can't negative value")
                                                                .setNeutralButton("Close", new DialogInterface.OnClickListener() {
                                                                    public void onClick(DialogInterface dlg, int sumthin) {
                                                                        finish();
                                                                    }
                                                                })
                                                                .show();
                                                            } else if (result&gt;9999999){
                                                                new AlertDialog.Builder(MainActivity.this)
                                                                .setTitle("Error")
                                                                .setMessage("result can't &gt; 9999999")
                                                                .setNeutralButton("Close", new DialogInterface.OnClickListener() {
                                                                    public void onClick(DialogInterface dlg, int sumthin) {
                                                                        finish();
                                                                    }
                                                                })
                                                                .show();
                                                            }else {
                                                                new AlertDialog.Builder(MainActivity.this)
                                                                .setTitle("result")
                                                                .setMessage(Integer.toString(result))
                                                                .setNeutralButton("Close", new DialogInterface.OnClickListener() {
                                                                    public void onClick(DialogInterface dlg, int sumthin) {
                                                                    }
                                                                })
                                                                .show();
                                                            }
                                                    }                                   
                                                    indexArray++;
                                                    */
                                                    break;
                                                case R.id.minus:
                                                    //str="Meeting Mode";
                                                    break;
                                                case R.id.substract:
                                                    //str="Silent Mode";
                                                    break;
                                                case R.id.divide:
                                                    //str="Offline Mode";
                                                    break;
                                            }
                                            }
                                        })
                                        .show();
                                    }
                                })
                                .show();
                        }
                 }
            })

            .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int whichButton) {
                 finish();
              }
            })
            .show();
    }
}
</code></pre>

<p>where the error with my code?</p>

<p>please help me.thanks</p>
