Bonjour à tous, voila je voulais développer un mini-jeu de math sous android, mais j'ai un problème lors de la récupération de certaine données avec mon intent, mon code n'est surement pas optimisée j’espère que vous serez indulgent pour ceci
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package com.example.assignement;
 
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
 
public class SecondActivity extends Activity {
 
	int a,b,result,good,i ;
	String childresult,realresult,goodstring,istring ;
	protected void onCreate(Bundle savedInstanceState) {
 
 
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_second);
 
		a = (int) (Math.random()*10 +1);
		b = (int) (Math.random()*10 +1);
		result = a + b ;
		final EditText value = (EditText) findViewById(R.id.editText1);
		TextView loginDisplay = (TextView) findViewById(R.id.textView1);
 
 
	    Intent intent = getIntent();
 
 
		if (intent != null) {
 
	      int realresult2 = Integer.parseInt(intent.getStringExtra(realresult)); 
			   int childresult2 = Integer.parseInt(intent.getStringExtra(childresult));
			   int goodscore = Integer.parseInt(intent.getStringExtra(goodstring));
			   int iscore = Integer.parseInt(intent.getStringExtra(istring));
 
			   if (childresult2 == realresult2)
				   {
 
				   good = goodscore +1 ;
				    i = iscore +1;
				    loginDisplay.setText(+a+"+"+b+"= ?  || score ="+good+"/"+i );
				    }
 
			   else
				   {
				   good = goodscore ;
				    i = iscore +1;
				    loginDisplay.setText(+a+"+"+b+"= ?  || score ="+good+"/"+i ); 
				    }
 
 
 
			  	loginDisplay.setText(+a+"+"+b+"= ?" );
 
 
 
 
				}
 
		else 
				{
 
			good = 0 ;
 
			i = 0;
			loginDisplay.setText(+a+"+"+b+"= ?" );
				}
 
 
 
 
 
 
		Button startButton = (Button) findViewById(R.id.button2);
		startButton.setOnClickListener(new View.OnClickListener(){
 
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent2 = new Intent(SecondActivity.this, SecondActivity.class);
				intent2.putExtra(childresult, value.getText().toString());
				intent2.putExtra(realresult, result);
				intent2.putExtra(goodstring, good);
				intent2.putExtra(istring, i);
				startActivity(intent2);
			}
 
		} );	
 
 
 
 
 
 
 
			Button backButton = (Button) findViewById(R.id.button1);
		backButton.setOnClickListener(new View.OnClickListener(){
 
			@Override
			public void onClick(View v) {
			//	 TODO Auto-generated method stub
 
				back();
			}
 
 
		} );
 
 
 
 
 
 
 
	}
 
 
 
 
 
	private void back() {
			// We back into the menu
			Intent backactivity = new Intent(this,MainActivity.class);
			startActivity(backactivity);
		}
 
 
 
}

Je me retrouve avec une erreur comme ceci

http://www.hostingpics.net/viewer.ph...6210erreur.jpg


Donc je viens de me rendre compte que l'erreur vient de
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
      int realresult2 = Integer.parseInt(intent.getStringExtra(realresult)); 
			   int childresult2 = Integer.parseInt(intent.getStringExtra(childresult));
			   int goodscore = Integer.parseInt(intent.getStringExtra(goodstring));
			   int iscore = Integer.parseInt(intent.getStringExtra(istring));
Car meme si je n'ai rien envoyer je rentre dans la boucle une idée comment faire ?