MyPlayActivity.java
1.36 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
package tonio.noa;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.view.View;
import android.widget.Toast;
/**
* Created by psyk on 09/01/18.
*/
public abstract class MyPlayActivity extends Activity {
public static final int REQUEST_CODE = 1;
protected TextToSpeech tts;
protected abstract void next();
protected void bravoPage(View view) {
startActivityForResult(new Intent(this, BravoActivity.class), REQUEST_CODE);
}
protected void lanceConsigne(String cons) {
Intent i = new Intent(this, ConsigneActivity.class);
i.putExtra("keyConsigne", cons);
int requestCode = 0;
startActivityForResult(i, requestCode);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
try {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
this.next();
finish();
}
} catch (Exception ex) {
Toast.makeText(MyPlayActivity.this, ex.toString(),
Toast.LENGTH_SHORT).show();
}
}
public void backHome(View view) {
startActivity(new Intent(this, MainActivity.class));
finish();
}
}