android: button click error (string array) : When I select an item with a spinner and click the button, I want to create a program that generates an array of choices with the spinner, such as 5 to add random numbers and float them in a textview. There are no errors, but when running, click the button to exit the program. Which part is the problem? The entire code is as follows:

    package ac.kr.kgu.esproject;

 

    import android.app.Activity;

    import android.os.Bundle;

    import android.provider.Settings.System;

    import android.view.View;

    import android.widget.AdapterView;

    import android.widget.ArrayAdapter;

    import android.widget.Spinner;

    import android.widget.Button;

    import android.widget.TextView;

    import android.widget.Toast;

 

    import java.util.ArrayList;

 

    public class ArrayAdderActivity extends Activity {

    static int numnum;

     

        @Override

        public void onCreate(Bundle savedInstanceState) {

            super.onCreate(savedInstanceState);

            setContentView(R.layout.main);

 

            final Spinner s = (Spinner) findViewById(R.id.spinner);

            final Button button1 = (Button) findViewById(R.id.button1);

            final TextView text1 = (TextView) findViewById(R.id.textv);

       

            ArrayAdapter adapter = ArrayAdapter.createFromResource(

                    this, R.array.planets, android.R.layout.simple_spinner_item);

            adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

            s.setAdapter(adapter);

        

            s.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

            String num=s.getSelectedItem().toString();

            numnum = Integer.parseInt(num);

                }

 

                public void onNothingSelected(AdapterView<?> parent) {
  
                }

    });

        

            button1.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {

            int array1[] = null;

            String string1[];

            for (int i = 0; i<numnum; i++){

            array1[i]=((int)(Math.random()));

            text1.setText("num #"+(i+1)+": "+array1[i]+"/n");

         

            }

         

            }

            });

 

        }

    }