Bonjour !

Je dois, dans le cadre de l'ISN (matière de découverte de l'informatique en terminale S), préparer une application toute simple sous Android.
Celle-ci est une interface de compte bancaire.

Je m'explique :

Elle ne contient qu'une seule fenêtre, sur laquelle se trouvent un champ pour rentrer le numéro de compte bancaire (enregistré dans l'application), et un tableau de 5 par 5, constitué de boutons, dont dix d'entre eux sont numérotés de 0 à 9. Ceux-ci doivent prendre une valeur aléatoirement à chaque ouverture du programme.

Bref, mon application se ferme dès son lancement sur émulateur, et je ne comprend vraiment pas pourquoi...
Si quelqu'un aurait une petite idée, voici le code source Java de l'application en question :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package com.example.tableau;
 
import java.util.Random;
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.EditText;
import android.view.View.OnClickListener;
 
 
public class MainActivity extends Activity implements OnClickListener {
	final CharSequence numBonCompte = "2401951802", bonCode = "1995";
	CharSequence codeEcrit = "";
	Button button[][] = new Button[5][5], valid = null, cancel = null;
	TextView code = null, result = null;
	EditText numCompte = null;
	Random rand = new Random();
 
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
 
		code = (TextView) findViewById(R.id.codeTxtId);
		numCompte = (EditText) findViewById(R.id.numId);
		valid = (Button) findViewById (R.id.validBut);
		valid.setOnClickListener(this);
		cancel.setOnClickListener(this);
		result = (TextView) findViewById (R.id.resultTxtId);
		result.setOnClickListener(this);
 
		init();
	}
	void init()
	{
		int num1=0, num2=0;
 
		// init de tous les bouttons
		button[0][0]= (Button) findViewById(R.id.but00);
		button[0][1]= (Button) findViewById(R.id.but01);
		button[0][2]= (Button) findViewById(R.id.but02);
		button[0][3]= (Button) findViewById(R.id.but03);
		button[0][4]= (Button) findViewById(R.id.but04);
		button[1][0]= (Button) findViewById(R.id.but10);
		button[1][1]= (Button) findViewById(R.id.but11);
		button[1][2]= (Button) findViewById(R.id.but12);
		button[1][3]= (Button) findViewById(R.id.but13);
		button[1][4]= (Button) findViewById(R.id.but14);
		button[2][0]= (Button) findViewById(R.id.but20);
		button[2][1]= (Button) findViewById(R.id.but21);
		button[2][2]= (Button) findViewById(R.id.but22);
		button[2][3]= (Button) findViewById(R.id.but23);
		button[2][4]= (Button) findViewById(R.id.but24);
		button[3][0]= (Button) findViewById(R.id.but30);
		button[3][1]= (Button) findViewById(R.id.but31);
		button[3][2]= (Button) findViewById(R.id.but32);
		button[3][3]= (Button) findViewById(R.id.but33);
		button[3][4]= (Button) findViewById(R.id.but34);
		button[4][0]= (Button) findViewById(R.id.but40);
		button[4][1]= (Button) findViewById(R.id.but41);
		button[4][2]= (Button) findViewById(R.id.but42);
		button[4][3]= (Button) findViewById(R.id.but43);
		button[4][4]= (Button) findViewById(R.id.but44);
 
		//remplissage aléatoire
		for(int i=0 ; i<10 ; i++)
		{
			num1=rand.nextInt(5);
			num2=rand.nextInt(5);
			if (button[num1][num2].getText().equals(""))
				button[num1][num2].setText(String.valueOf(i));
			else
				i--;
		}				
	}
	@Override
	public void onClick (View v) {
		int ok=0;
		if ((v==valid) && (numCompte.getText().equals(numBonCompte)) && (codeEcrit.equals(bonCode)))
		{
			result.setText("Paiement accepté");
		}
		else if (v==valid)
		{
			result.setText("Paiement refusé");
		}
		else
			for (int i=0 ; i<5 ; i++)
			{
				for(int j=0 ; j<5 ; j++)
				{
					if (v==button[i][j])
					{
						codeEcrit = codeEcrit.toString().concat(button[i][j].getText().toString());
						code.setText(code.getText().toString().concat("*"));
						ok=1;
						break;
					}
				}
				if (ok==1)
					break;
			}
	}
}