Android Activity keeps crashing without an error : <p>I made an incredibly simple app but for some reason it's just crashing. The first page is a simple login screen however the moment I click login it just crashes. The strange part is that there's not even any heavy code to make it do anything strange like that; I'm just making it travel between activities so far.</p>

<p>The main activity</p>

<pre><code>package com.example.philip.lottery1;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class LoginActivity extends AppCompatActivity {
Button loginButton;
EditText userNameField;
EditText passwordField;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    loginButton = (Button) findViewById(R.id.loginButton);
    userNameField = (EditText) findViewById(R.id.userNameField);
    passwordField = (EditText) findViewById(R.id.passwordField);
    final String userName = userNameField.getText().toString();
    String password = passwordField.getText().toString();

    loginButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {

            Intent intent = new Intent(getApplicationContext(), CreateTicket.class);
            intent.putExtra("ClerkID", userName);
            startActivity(intent);
        }
    });
}


}
</code></pre>

<p>The activity it leads to</p>

<pre><code>package com.example.philip.lottery1;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import java.util.Random;

public class CreateTicket extends AppCompatActivity {
private Button randomButton;
private Button OKButton;
private Button searchButton;
private EditText[] lottoNumberFields;
private int[] lottoNumbers;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_create_ticket);
    lottoNumberFields = new EditText[5];
    lottoNumberFields[1] = (EditText)findViewById(R.id.num1);
    lottoNumberFields[2] = (EditText)findViewById(R.id.num2);
    lottoNumberFields[3] = (EditText)findViewById(R.id.num3);
    lottoNumberFields[4] = (EditText)findViewById(R.id.num4);
    lottoNumberFields[5] = (EditText)findViewById(R.id.num5);
    randomButton = (Button) findViewById(R.id.randomButton);
    OKButton = (Button) findViewById(R.id.OKButton);
    searchButton = (Button) findViewById(R.id.searchButton);

    randomButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            randommize();
        }
    });

    OKButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            createTicket();
        }
    });

    searchButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            search();
        }
    });
}

private void search()
{
    //insert code here
    Intent intent = new Intent (getBaseContext(),TicketActivity.class);
    startActivity(intent);
}

private void randommize()
{
    for (int i = 0 ; i &lt; 5 ; i ++)
    {
        Random random = new Random();
        int num = random.nextInt(49) + 1;
        lottoNumberFields[i].setText(num+"");
    }
}

private void createTicket()
{
    for (int i = 0; i &lt; 5; i++)
    {
        lottoNumbers[i] = Integer.parseInt(lottoNumberFields[i].getText().toString());
    }
    Intent intent = new Intent(getBaseContext(), FinalActivity.class);
    intent.putExtra("lottoNumbers",lottoNumbers);
    startActivity(intent);
}
}
</code></pre>
