-
Notifications
You must be signed in to change notification settings - Fork 0
/
AdditionAdvIncorrect.java
48 lines (40 loc) · 1.9 KB
/
AdditionAdvIncorrect.java
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
package com.example.funmathv2;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class AdditionAdvIncorrect extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_addition_adv_incorrect);
int addAdvFirst;
int addAdvSecond;
if ((getIntent().hasExtra(("funMath.addAdvFirst")) && (getIntent().hasExtra("funMath.addAdvSecond")))) {
addAdvFirst = getIntent().getExtras().getInt("funMath.addAdvFirst"); // to be the same names in incorrect.class
addAdvSecond = getIntent().getExtras().getInt("funMath.addAdvSecond");
} else {
addAdvFirst = 0;
addAdvSecond = 0;
}
Button buttonAdditionAdvTryAgain = (Button) findViewById(R.id.buttonAdditionAdvTryAgain);
buttonAdditionAdvTryAgain.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent startAdditionAdv = new Intent(getApplicationContext(), AdditionAdv.class);
startAdditionAdv.putExtra("funMath.addAFirstNumber", addAdvFirst);
startAdditionAdv.putExtra("funMath.addASecondNumber", addAdvSecond);
startActivity(startAdditionAdv);
}
});
Button buttonAdditionAdvBack = (Button) findViewById(R.id.buttonAdditionAdvBack);
buttonAdditionAdvBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent startMainActivity = new Intent(getApplicationContext(), MainActivity.class);
startActivity(startMainActivity);
}
});
}
}