Android Studio Veja de que atividade você veio

// Activity A and Activity B both send to Activity C
// In order to decide which Activity you came from use the following code:

// In Activity A:
Intent intent = new Intent(this, C.class);
intent.putExtra("camefrom", "A");
startActivity(intent);

// In Activity B:
Intent intent = new Intent(this, C.class);
intent.putExtra("camefrom", "B");
startActivity(intent);

// In Activity C:
Intent intent = getIntent();
String cameFrom= intent.getStringExtra("camefrom");

if(cameFrom.equals("A");
// It is from A
else
// It is from B
adreaskar