Is there a way to know which activity class started another activity class other than passing the name of the class as an Extra
in the Intent
?
When we do new Intent(this, SomeOtherActivity.class)
is it possible to get the name of this
in the when we are in onCreate
of the SomeOtherActivity
?
Create an instance and put an extra to the intent:
Intent i = new Intent(this, SomeOtherActivity.class)
i.putExtra("ACTIVITY_NAME", this.getClass().getName());
Retrieve it with:
Bundle extras = getIntent().getExtras();
String activityName = extras.getString("STRING_I_NEED");