Blame view

app/src/main/java/tonio/noa/MyPlayActivity.java 1.04 KB
d55d5943   aarnaude   resolution Bravo
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
  package tonio.noa;
  
  import android.app.Activity;
  import android.content.Intent;
  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 abstract void next();
  
      protected void bravoPage(View view){
          startActivityForResult(new Intent(this, BravoActivity.class), REQUEST_CODE);
      }
      @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();
      }
  }