New to Android. Please Help Point Out Issues
<p>Like the title says im new to android. I have already learned quite a bit. 
I would just like to know if theres anything in my code I could make better?
It seems to be too much for such a simple app.
What can I consolidate?
Also what would you recommend for me to do to catch when a user presses submit before entering a number.</p>

<pre><code>package com.michaelpeerman.probability;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
import android.widget.Toast;

import java.util.Random;

public class ProbabilityActivity extends Activity implements OnClickListener {

private Button submit;
ProgressDialog dialog;
int increment;
Thread background;
int heads = 0;
int tails = 0;
int maximum;
EditText max;

String max_string = "1000000";
int max_int = 1000000;

public void onCreate(Bundle paramBundle) {
    super.onCreate(paramBundle);
    setContentView(R.layout.main);
    submit = ((Button) findViewById(R.id.submit));
    submit.setOnClickListener(this);
    EditText max = (EditText) findViewById(R.id.number);
    max.setOnEditorActionListener(new OnEditorActionListener() {

        public boolean onEditorAction(TextView v, int actionId,
                KeyEvent event) {
            if ((event != null &amp;&amp; (event.getKeyCode() == KeyEvent.KEYCODE_ENTER))
                    || (actionId == EditorInfo.IME_ACTION_DONE)) {
                submit();
            }
            return false;

        }
    });

}

public void onClick(View view) {
    submit();

}

public void submit() {
    EditText max = (EditText) findViewById(R.id.number);
    maximum = Integer.parseInt(max.getText().toString());
    if (maximum &gt;= max_int) {
        maximum = max_int;
        max.setText(max_string);
        Context context = getApplicationContext();
        CharSequence text = "You entered a number greater than ten million. Setting number to ten million.";
        int duration = Toast.LENGTH_LONG;

        Toast toast = Toast.makeText(context, text, duration);
        toast.show();
        startThread();

    } else {
        startThread();
    }
}

public void startThread() {
    increment = 1;
    dialog = new ProgressDialog(this);
    dialog.setCancelable(true);
    dialog.setMessage("Flipping Coin...");
    dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    dialog.setProgress(0);
    dialog.setMax(maximum);
    dialog.show();
    dialog.setOnCancelListener(new OnCancelListener() {

        public void onCancel(DialogInterface dialog) {

            background.interrupt();
            TextView result = (TextView) findViewById(R.id.result);
            result.setText("heads : " + heads + "\ntails : " + tails);

        }
    });

    background = new Thread(new Runnable() {
        public void run() {
            heads = 0;
            tails = 0;
            for (int j = 0; !Thread.interrupted() &amp;&amp; j &lt; dialog.getMax(); j++) {
                int i = 1 + new Random().nextInt(2);
                if (i == 1)
                    heads++;
                if (i == 2)
                    tails++;
                progressHandler
                .sendMessage(progressHandler.obtainMessage());
            }
        }
    });
    background.start();
}

Handler progressHandler = new Handler() {
    public void handleMessage(Message msg) {

        dialog.incrementProgressBy(increment);
        if (dialog.getProgress() == dialog.getMax()) {
            dialog.dismiss();
            TextView result = (TextView) findViewById(R.id.result);
            result.setText("heads : " + heads + "\ntails : " + tails);

        }
    }

};

}
</code></pre>
