Hey you can put data in the intent you use to start this activity. So you can put a different identifier depending on wich "previous" activity started this one. like so :
Intent intent = new Intent(getBaseContext(), NextActivity.class);
intent.putExtra("PREVIOUS_ACTIVITY", this.getClass().getSimpleName());
startActivity(intent)
then you can retrieve this information by doing :
then in the NextActivity, retrieve the values in onCreate()
:
Bundle extras = getIntent().getExtras();
if (extras != null) {
String previous activity= extras.getString("PREVIOUS_ACTIVITY");
}
Then you can test the variable and do wathever you want. Hope this help.