Reputation: 6951
I am wondering about the following. In the Android documentation they recommend the following:
"Tip: When your configuration Activity first opens, set the Activity result to RESULT_CANCELED, along with EXTRA_APPWIDGET_ID, as shown in step 5 above. This way, if the user backs-out of the Activity before reaching the end, the App Widget host is notified that the configuration was cancelled and the App Widget will not be added."
https://developer.android.com/guide/topics/appwidgets/index.html#Configuring
But isn't that redundant, since the default value is RESULT_CANCELED (0) anways? Am I missing something? Can there be cases where the result is not at 0 when we open the configuration activity?
Upvotes: 1
Views: 126
Reputation: 39191
The important part of that statement is "along with EXTRA_APPWIDGET_ID". You're correct that the result code will be RESULT_CANCELED
by default, but there isn't going to be a result Intent
with the Widget ID attached by default.
Certainly, any launcher that allows Widgets should be able to handle it gracefully if that Intent
is not set, but it's a known issue that at least some do not.
Upvotes: 1