问题
I am using an activity from a third-party library that has set android:noHistory to "true". Is it possible for me to override that value in code before I launch the activity?
Is there an opposite of "FLAG_ACTIVITY_NO_HISTORY" flag I could use with the Intent?
回答1:
I am using an activity from a third-party library that has set android:noHistory to "true".
Add an <activity>
element to your own app's manifest, with an android:name
attribute identifying the activity, and with android:noHistory="false"
. As part of the manifest merger process, your app's android:noHistory
value should override the library's android:noHistory
value.
In general, overriding a library's manifest entry is a somewhat risky move, as you could break something that the library depends upon. In this particular case, it should be safe.
回答2:
If set, the new activity is not kept in the history stack. As soon as the user navigates away from it, the activity is finished. This may also be set with the noHistory attribute.
If set, onActivityResult() is never invoked when the current activity starts a new activity which sets a result and finishes.
https://developer.android.com/reference/android/content/Intent#FLAG_ACTIVITY_NO_HISTORY
来源:https://stackoverflow.com/questions/55119387/can-i-override-androidnohistory-in-code