I have many activities. Each one of them has an intent which refers to the same activity. Is there a way to find out which intent started the activity?
I found a solution that doesn't involve passing data from one Activity to another.
Use startActivityForResult in your calling activity to start the activity:
ActivityCompat.startActivityForResult(this, new Intent(this, MyActivity.class), 0, null);
In the callee Activity, you can use the following code to detect the calling activity.
if (getCallingActivity() != null) {
Log.d(TAG, getCallingActivity().getClassName());
}
Hope this helps. Cheers.