Android Studio Vea de qué actividad viniste

// 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