ondestroy Questions

2

Solved

I'm trying to execute some code whenever my activity is killed, but not when it's simply moved to the background (so just calling it in onPause() isn't a solution), and I understand onDestory() is ...
Outbid asked 27/5, 2014 at 19:26

1

Solved

I have a Service that is binded with BIND_AUTO_CREATE to my Activity and is started with START_STICKY. I do not explicitly call startService(). Since the onDestroy() method is not always called wh...
Gingham asked 8/4, 2014 at 14:16

4

I have a FragmentActivity (Support Fragments) where I create Fragments by code and put them into FrameLayouts. It all works fine so far. Now if I leave the App an return everything is fine as long...

3

In my Activity some external thing (service) need to be destroyed in onDestroy(). But I do not want this when configuration change happens (e.g. keyboard flips out) because it will be restored righ...
Keel asked 16/7, 2011 at 10:58

2

Solved

I'm aware that a Service's onDestroy() method may never be called but can someone tell me when such a scenario might occur? I'm especially interested in whether it's possible for a Service to be ki...
Rushy asked 3/1, 2013 at 21:50

4

Solved

I'm writing a tasklist and have Project object, which holds all the tasks (and metadata). I use action log, so when tasks changes i do not save it immediately to database, just keep it in memory to...
Incorrect asked 19/12, 2012 at 16:15

2

Solved

Simple question: can you be sure that finish() will call onDestroy()? I haven't found any confirmation on this.
Designing asked 10/11, 2013 at 16:15

3

Solved

I have put some cache cleaning code in onDestroy of my activity but most of the time the code is not executed unless I explicitly finish the activity via finish(). Edit: Just read onDestroy is cal...
Swirl asked 26/10, 2013 at 16:20

4

Solved

I have an activity with a checkbox: if the chekbox is unchecked then stop the service. this is a snippet of my activity code: Intent serviceIntent = new Intent(); serviceIntent.setAction("com.an...
Tunicle asked 10/1, 2011 at 22:1

1

Solved

I want to send logout information to server, when the app gets destroyed. Here's the code: @Override protected void onDestroy() { try { Log.i("myApp", "Activity destroyed"); SharedPreferences ...
Actinia asked 21/5, 2013 at 11:24

3

Solved

I am using following code in my ListActivity // a separate class in project public class MyActivity extends ListActivity { // some common functions here.. } public class SelectLocation extends M...
Popover asked 15/12, 2010 at 12:40

2

This is very odd. I have a simple app which once logged in shows a fragment in an activity. The app also has an inactivity "timeout" after which time it finishes the activity and shows the login sc...

5

Solved

Let's say we have a default, empty activity with default behaviour, launched with default intent flags. User presses back button on the device. The activity disappear... but how, actually? Is pre...
Holmquist asked 23/7, 2012 at 10:58

3

When a service has been killed, how to restart it automatically? sometimes without even calling onDestroy()
Daunt asked 12/1, 2011 at 7:10

1

Solved

A question, maybe a little naive... If I start a 2 minute CountDownTimer in Activity onCreate() and close it with finish() when user clicks a button, does Android cancel it automatically? Or do I...
Breeches asked 27/8, 2012 at 10:26

2

Solved

My app runs a geolocalisation service that the user can active or disactive by a toggleButton. To check the status of the service, I write a boolean in the Shared Preferences. I listen the beginnin...
Enslave asked 2/5, 2011 at 20:20

1

Solved

I have an app with two activities: "A" and "B". "A" uses startActivityForResult() to spawn "B" i.e. it waits for "B". Now, assume that "B" is in foreground. Can the Android system destroy activity...
Cooperative asked 25/4, 2012 at 15:59

1

Solved

I'm confused about Activity.onDestroy(). I need to free some resources when my Activity is destroyed, but it seems like onDestroy() is called just when i press "Back" key, but not when my Activity ...
Presuppose asked 29/12, 2011 at 10:59

3

Actually I know i am asking about the simple and basic concept of Android. But I am a little bit confused about these finish() and onDestroy() methods. Whether this will kill the activity and free...
Pinchbeck asked 24/5, 2011 at 10:9

1

Solved

Is it okay if we override OnDestroy() method in every activity of Android Application? @Override public void onDestroy() { super.onDestroy(); } Just by calling super.onDestroy() in onDestroy()...
Coffin asked 5/5, 2011 at 5:56

2

Solved

I've been bothered by this "characteristics": When I use Back button to leave my app, I can tell onDestroy() is called, but the next time I run my app, all the static members of the Activity class ...
Halvah asked 13/2, 2011 at 1:30

1

Solved

I have a bug in my code that made me think I don't fully understand the Android Lifecycle. Yes, I have read all the docs and looked at the diagrams, but they seem to talk only about when to save da...
Chauffer asked 16/12, 2010 at 14:50

1

Solved

If I override my main Activity's onDestroy() method in order to recycle a bitmap when the screen is rotated, should I call super.onDestroy() before or after myBitmap.recycle()? Does it matter?
Winograd asked 3/2, 2010 at 23:5

© 2022 - 2024 — McMap. All rights reserved.