Is it safe to assume the new activity will have priorty over the
previous activity that is no longer accessible? Will there not a
potentially corrupted zombie-process still lurking as the app
continues on its merry way? Is it not more likely an exit() of some
kind would allow the system to clean-up unforeseen effects of the
corruption than the chance that the system would bringing any back
from the dead the next time the app starts up?

On May 28, 3:11 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> On Mon, May 28, 2012 at 4:56 PM, Yan <yinor...@gmail.com> wrote:
> > Thanks for the idea "to pull out the battery" notification! You
> > guessed right about the category of "people treating Android like
> > Linux". Which begs the question of what system call would you use if
> > your app's data got corrupted and the final() call could not handle
> > it. Would you consider it permissible to kill your own process?
>
> No.
>
> In the beginning, the device does not have your app. Then, the user
> installs your app. Then, the user runs your app for the first time.
>
> At this moment, your app has no data on persistent storage (e.g.,
> databases). Hence, your app needs to handle the first-run scenario
> where your app has no data on persistent storage -- otherwise, your
> app can never run successfully, and this is all a moot point.
>
> Similarly, at this moment, your app has no data in memory (e.g.,
> static data members). Hence, your app needs to handle the first-run
> scenario where your app has no data in memory -- otherwise, your app
> can never run successfully, and this is all a moot point.
>
> If, during the operation of your app, you determine that your data is
> irreversibly corrupted, you wipe the data in persistent storage, null
> out the static data members, and start over, along with launching an
> activity with FLAG_ACTIVITY_CLEAR_TOP + FLAG_ACTIVITY_SINGLE_TOP to
> let the user know that you had to wipe out their data. You do not need
> to terminate your process to achieve any of this.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training...At Your Office:http://commonsware.com/training

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to