-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCorrect.java
More file actions
80 lines (69 loc) · 1.85 KB
/
Copy pathCorrect.java
File metadata and controls
80 lines (69 loc) · 1.85 KB
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
package com.testyourself.knowyoursport;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.media.MediaPlayer;
import android.view.View;
public class Correct extends Activity {
int q;
int category;
String DB_NAME;
MediaPlayer mp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_correct);
}
public void correct(View v) {
mp.start();
// Bundle bundle=getIntent().getExtras();
Bundle bundle = getIntent().getExtras();
q = bundle.getInt("from");
category = bundle.getInt("category");
if (category == 1) {
Intent i = new Intent(Correct.this, Questions.class).putExtra(
"from", q + 1);
startActivity(i);
overridePendingTransition(R.anim.rightin, R.anim.rightout);
}
if (category == 2) {
Intent i = new Intent(Correct.this, Questions2.class).putExtra(
"from", q + 1);
startActivity(i);
overridePendingTransition(R.anim.rightin, R.anim.rightout);
}
}
@Override
protected void onStop() {
super.onStop();
// Deallocate all memory
if (mp != null) {
if (mp.isPlaying()) {
mp.stop();
}
mp.release();
mp = null;
}
}
@Override
protected void onResume() {
super.onResume();
mp = MediaPlayer.create(this, R.raw.button);
}
@Override
public void onBackPressed() {
mp.start();
Bundle bundle = getIntent().getExtras();
category = bundle.getInt("category");
if (category == 1) {
Intent i = new Intent(Correct.this, Buttons.class);
startActivity(i);
overridePendingTransition(R.anim.leftin, R.anim.leftout);
}
if (category == 2) {
Intent i = new Intent(Correct.this, Buttons2.class);
startActivity(i);
overridePendingTransition(R.anim.leftin, R.anim.leftout);
}
}
}