Why my app doesnt pass to the next activity : <p>im trying to pass from the main activity to the second activity and also pass a number and it doesn't work 
can someone show my what my mistake is </p>

<p>p.s
can anyone tell me how to do i make a loop that stops for the user to press the button to add text in the EditText and then reset the EditText and wait for him again to insert another text until an array is filled</p>

<p>thank you!!</p>

<pre><code>public class MainActivity extends AppCompatActivity {

public static int numOfSails;
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

try{
    Button nextButton = (Button) findViewById(R.id.next_button);
    EditText sailsNumET = (EditText) findViewById(R.id.sails_num);
    numOfSails = Integer.parseInt(sailsNumET.toString());
    nextButton.setOnClickListener(new View.OnClickListener(){
        @Override
        public void onClick(View view){
            Intent addingIntent = new Intent(MainActivity.this,AddingActivity.class);
            addingIntent.putExtra("nos",numOfSails);
            startActivity(addingIntent);

        }
    });


     }catch(NumberFormatException e){

  }
 }
}
</code></pre>

<p>and in the second activity this is the code</p>

<pre><code>public class AddingActivity extends AppCompatActivity {
public ArrayList&lt;Sail&gt; sails = new ArrayList&lt;Sail&gt;();
public static int numOfSails;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.adding_main);
    final Button addButton = (Button) findViewById(R.id.add_button);
    final EditText minusInGallonsET = (EditText) findViewById(R.id.gallons_num);
    final TextView counterET = (TextView) findViewById(R.id.counter_id);
    Bundle bundle = getIntent().getExtras();
    this.numOfSails = bundle.getInt("nos",0);
    for (int i = 0 ; i&lt; numOfSails; i++){
        sails.add(new Sail());
    }

    addButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            int counter = 0;
            for (Sail s : sails){
                s.setFuelInGallons(Integer.parseInt(minusInGallonsET.toString()));
                s.setSailNum(counter);
                counter++;
                counterET.setText(counter);
            }
               }
    });

 }
}
</code></pre>
