I have a button in my main activity (act1) and in a widget. That button starts a different activity (act2).
In act1, I start act2 by doing startActivityForResult. When it’s done, I handle it with onActivityResult.
However, in the widget, I start act2 by using a PendingIntent. When act2 is finished, it returns to act1 but does not trigger onActivityResult.
How do I make it hit onActivityResult when it returns to act1 or at least find out if act2 was started by the widget?
You don’t. “act1” will only be called with
onActivityResult() if it calledstartActivityForResult().Put something in the
Intent(e.g., custom action string or an extra) to differentiate the two cases.