title: Is there a way to make your program wait untill a button is pressed android studio?
body: <p>currently I am trying to populate 3 string arrays using 3 edittext fields in which the user will enter some information. currently I am doing the following:</p>
  <pre><code>String[] a,b,c = new String[x];
  int i = 0
  Button Submit;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_form);
          Intent intent = getIntent();
          x = intent.getIntExtra(&quot;x&quot;, 0);
  
          submit.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  if(i&lt;x) {
                      a[i] =findViewById(R.id.field1).getText().toString();
                      b[i] =findViewById(R.id.field2).getText().toString();
                      c[i] =findViewById(R.id.field3).getText().toString();   
               ((EditText) findViewById(R.id.field1)).getText().clear();
               ((EditText) findViewById(R.id.field2)).getText().clear();
               ((EditText) findViewById(R.id.field3)).getText().clear();
               i++;  
               }else{
               Intent intent = new Intent(form.this, compact.class);
                          intent.putExtra(Strings)
        }
  }
  </code></pre>
  <p>My code is currently stuck in the if statement and it is unable to proceed to the else case and send the data, please let me know what I need to do in order to fix it or if there is a different approach I should use.</p>
  <p>Basically what I am trying to do is allow the user to enter data into x number of forms.</p>
  <p>Thanks, any help is appreciated.</p>