I would suggest:
public static final String INTENTSENDER = "sender"; void mMethod() { Intent intent = new Intent(context, mClass); intent.putExtra(INTENTSENDER, mClass); context.startActivity(intent); }
knowing who sent it:
Class<?> c = (Class<?>)intent.getExtras().get(INTENTSENDER);
However, you can also use this:
ComponentName componentName = this.getCallingActivity();
Now you can use componentName to get the sender of the intent.
source share