开发者

Any way to force an activity to destroy right away but also remain on the stack?

开发者 https://www.devze.com 2023-02-07 03:52 出处:网络
I have a preference activity that allows the user to modify skinning options. If the user modifies the skinning options, I need to reload the activity (call startActivity() with the current intent fol

I have a preference activity that allows the user to modify skinning options. If the user modifies the skinning options, I need to reload the activity (call startActivity() with the current intent followed by finish() ) so that the drawables are properly reloaded.

It would be much easier, and much more reliable, if I could force the current activity to get destroyed rather than paused whenever the preference activity starts.

Any ideas how I can achieve this?

Update for clarity:

CURRENT BEHAVIOR:

1. Activity A starts
2开发者_C百科. User selects Settings command
3. Preference Activity starts
4. Activity A is paused
5. User changes preferences
6. Preference Activity is paused and destroyed
7. Activity A is unpaused
8. Activity A must check if preferences were changed
   - If yes, call startActivity() to start itself 
     again and call finish(). This will reload everything
     correctly

DESIRED BEHAVIOR (diff in BOLD):

1. Activity A starts
2. User selects Settings command
3. Preference Activity starts
4. Activity A is paused AND DESTROYED
5. User changes preferences
6. Preference Activity is paused and destroyed
7. Activity A STARTS AGAIN FRESH

Cheers, swine


You can empty your bundle and call onCreate() again. I am not sure, but you can try for once atleast

0

精彩评论

暂无评论...
验证码 换一张
取 消