-
Notifications
You must be signed in to change notification settings - Fork 0
/
SubtractionBasicIncorrect.java
48 lines (40 loc) · 1.99 KB
/
SubtractionBasicIncorrect.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 SubtractionBasicIncorrect extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_subtraction_basic_incorrect);
int subBasicFirst;
int subBasicSecond;
if ((getIntent().hasExtra(("funMath.subBasicFirst")) && (getIntent().hasExtra("funMath.subBasicSecond")))) {
subBasicFirst = getIntent().getExtras().getInt("funMath.subBasicFirst"); // to be the same names in incorrect.class
subBasicSecond = getIntent().getExtras().getInt("funMath.subBasicSecond");
} else {
subBasicFirst = 0;
subBasicSecond = 0;
}
Button buttonSubtractionBasicTryAgain = (Button) findViewById(R.id.buttonSubtractionBasicTryAgain);
buttonSubtractionBasicTryAgain.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent startSubtractionBasic = new Intent(getApplicationContext(), SubtractionBasic.class);
startSubtractionBasic.putExtra("funMath.subBFirstNumber", subBasicFirst);
startSubtractionBasic.putExtra("funMath.subBSecondNumber", subBasicSecond);
startActivity(startSubtractionBasic);
}
});
Button buttonSubtractionBasicBack = (Button) findViewById(R.id.buttonSubtractionBasicBack);
buttonSubtractionBasicBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent startMainActivity = new Intent(getApplicationContext(), MainActivity.class);
startActivity(startMainActivity);
}
});
}
}