-
Notifications
You must be signed in to change notification settings - Fork 0
/
AdditionBasicIncorrect.java
48 lines (40 loc) · 1.95 KB
/
AdditionBasicIncorrect.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 AdditionBasicIncorrect extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_addition_basic_incorrect);
int addBasicFirst;
int addBasicSecond;
if ((getIntent().hasExtra(("funMath.addBasicFirst")) && (getIntent().hasExtra("funMath.addBasicSecond")))) {
addBasicFirst = getIntent().getExtras().getInt("funMath.addBasicFirst"); // to be the same names in incorrect.class
addBasicSecond = getIntent().getExtras().getInt("funMath.addBasicSecond");
} else {
addBasicFirst = 0;
addBasicSecond = 0;
}
Button buttonAdditionBasicTryAgain = (Button) findViewById(R.id.buttonAdditionBasicTryAgain);
buttonAdditionBasicTryAgain.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent startAdditionBasic = new Intent(getApplicationContext(), AdditionBasic.class);
startAdditionBasic.putExtra("funMath.addBFirstNumber", addBasicFirst);
startAdditionBasic.putExtra("funMath.addBSecondNumber", addBasicSecond);
startActivity(startAdditionBasic);
}
});
Button buttonAdditionBasicBack = (Button) findViewById(R.id.buttonAdditionBasicBack);
buttonAdditionBasicBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent startMainActivity = new Intent(getApplicationContext(), MainActivity.class);
startActivity(startMainActivity);
}
});
}
}