I have an application with a button that takes us from Activity A (Main) to Activity B, I would like that when I close activity B with an onBackPressed () the application A (Main) will detect that it is the activity again active and act by making a method, is that possible?
Thanks in advance,
Edit1:
Code in MainActivity ()
botonActividadB.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent a = new Intent(MainActivity.this, ActividadB.class);
MainActivity.this.startActivity(a);
}
});
Code in ActivityB
@Override
public void onBackPressed() {
super.onBackPressed();
this.finish();
}
My intention is for onBackPressed to have MainActivity execute a method, without the need to pass parameters between MainActivity and ActivityB, so how do I get MainActivity to detect which ActivityB has finished?