You should not do it because of these:
https://groups.google.com/forum/?fromgroups=#!topic/android-developers/Y96KnN_6RqM
 
 (See Dianne's response)
http://stackoverflow.com/questions/11257449/system-exit-in-android

And in case you missed it - another reason not to do it: because it behaves 
differently for you on 4.2 :)

4.2 treats foreground services differently, maybe that's the cause, but 
finding a reason for something you shouldn't do is kind of a waste of 
time... 

On Tuesday, April 2, 2013 1:20:41 PM UTC+3, Bunty syed wrote:
>
> But my concern is why its behaving different way on only 4.2 android 
> platform device..
>
>
> On 2 April 2013 15:27, Piren <[email protected] <javascript:>> wrote:
>
>> That's still not the preferred  way to do it... You should always clean 
>> up after you and stop these on your own. 
>>
>>
>> On Tuesday, April 2, 2013 11:12:17 AM UTC+3, Bunty syed wrote:
>>
>>> Thanks. Actually I want to destroy all background process, threads 
>>> related to app so I am doing System.exit(0)...Finish will destroy only the 
>>> UI but the application will keep running ..
>>>
>>> On 2 April 2013 13:31, Piren <[email protected]> wrote:
>>>
>>>> You should not be calling System.exit either way...calling Finish would 
>>>> achieve the proper result.
>>>>
>>>> P.S - any reason why you're using the package manager to get a launcher 
>>>> intent for your own application? 
>>>>
>>>>
>>>>
>>>> On Tuesday, April 2, 2013 10:43:27 AM UTC+3, Bunty syed wrote:
>>>>>
>>>>> Hi All,
>>>>>
>>>>> Hope doing well.
>>>>>
>>>>> Actually I have one application which is behaving different on android 
>>>>> 4.2 platform device.
>>>>>
>>>>> In my application, there are three activities.
>>>>>
>>>>> From first activity *(Launcher activity*), i navigate to second 
>>>>> activity and then from second activity,I navigate to third activity.
>>>>>
>>>>> In third activity, I have a button on clicking tat , I am launching 
>>>>> following intent ..
>>>>>
>>>>>                         Intent i = new Intent(Intent.ACTION_MAIN);
>>>>>
>>>>>                         PackageManager manager = 
>>>>> context.getPackageManager();
>>>>>
>>>>>                         i = 
>>>>> manager.**getLaunchIntentForPack**age("**com.myapp");    
>>>>>
>>>>>                 
>>>>>                         i.addCategory(Intent.CATEGORY_****LAUNCHER);    
>>>>>      
>>>>>                
>>>>>                         i.setFlags(Intent.FLAG_**ACTIVIT**Y_NEW_TASK 
>>>>> | Intent.FLAG_ACTIVITY_CLEAR_**TOP**);
>>>>>
>>>>>                          i.putExtra(EXITAPP,  true);    
>>>>>                    
>>>>>                         startActivity(i);
>>>>>
>>>>> Above  intent launches the *first activity* by clearing the all top 
>>>>> activities. In the first activity onCreate method, i check for the 
>>>>> *EXITAPP 
>>>>> *flag in the intent & do System.exit(0) if it is present.
>>>>> This way it *kills *my app completely after cliking button.
>>>>> Above logic works fine for all devices upto *4.1 android platform.*
>>>>>
>>>>> But in 4.2 android platform device, on doing System.exit(0) in the 
>>>>> first activity onCreate *kill *the the current process & *restarts *the 
>>>>> application..
>>>>>
>>>>> Is it the behavioral change in the android 4.2 platform or I need to 
>>>>> do something different to achieve above case for 4.2
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>  -- 
>>>> -- 
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Android Developers" group.
>>>> To post to this group, send email to android-d...@**googlegroups.com
>>>>
>>>> To unsubscribe from this group, send email to
>>>> android-developers+**[email protected]
>>>> For more options, visit this group at
>>>> http://groups.google.com/**group/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en>
>>>> --- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Android Developers" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to android-developers+**[email protected].
>>>>
>>>> For more options, visit 
>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>> .
>>>>  
>>>>  
>>>>
>>>
>>>  -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to 
>> [email protected]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Android Developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to