My goal is to avoid using Else as I always do in Javascript code
In the example below, is there a solution?
public void initView() {
ContextCompat.startForegroundService(this, new Intent(MainActivity.this, ViewService.class));
finish();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CODE_DRAW_OVER_OTHER_APP_PERMISSION) {
if (resultCode == RESULT_OK) {
initView();
} else {
Toast.makeText(this, "Permission not available", Toast.LENGTH_SHORT).show();
finish();
}
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
Aucun commentaire:
Enregistrer un commentaire