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(); } }