Tuesday, April 2, 2013

Re: [android-developers] Re: Application behavior is different on 4.2 android platform device

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 <gpi...@gmail.com> 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.getLaunchIntentForPackage("com.myapp");   
               
                        i.addCategory(Intent.CATEGORY_LAUNCHER);        
              
                        i.setFlags(Intent.FLAG_ACTIVITY_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+unsubscribe@googlegroups.com
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 android-developers+unsubscribe@googlegroups.com.

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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
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 android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment