Android :: How Do I Know If Activity.onStop Is Being Called?

Dec 3, 2009

I need be able to tell if Activity.onStop() was called because my application is moving to a new activity, or if it was closed because the user pressed the "Home" key or hit the back button from the bottom of the activity stack.The reason is because I need to know when it is appropriate to shut off music that is playing in my application (A game). There is nothing more annoying than hitting home and having something playing music in the background.However, Activity.OnStop() is called for each activity change, and I don't want to suspend music when moving between multiple activities in my app. I just can't find a way to differentiate between going home and going to a internal activity.Am I perhaps hooking into the wrong events?

Android :: How do I know if Activity.onStop is being called?


Android :: Activity Lifecycle On Nexus One - OnStop Not Called

Mar 4, 2010

I have a problem with the activity lifecycle specifically on Nexus One (2.1 running on emulator works fine). If I just create a simple empty Activity with no special launchModes that logs the calls on the onStart and onStop methods, this is what I see: - launch app: onStart called; - home button: onStop NOT called; - launch app: onStart NOT called; - home button: onStop NOT called: and so on. Sometimes if I press the back button then the onStop is not called, but the when i launch the activity again the onStart is called and right after the onStop is called. Similar results with different launchModes. What is going on? Can anyone confirm this?
i found an android issue for the problem here: http://code.google.com/p/android/issues/detail?id=6094 and a similar thread here http://groups.google.com/group/android-developers/browse_thread/threa.

View 24 Replies View Related

Android :: OnStop OnDestroy Called From Back Key Or Not ?

Sep 17, 2009

Each time I switch the orientation of the device, onStop() and onDestroy() are called. They are also called when I close the Avtivity (dismiss()), and when I press 'back' key. In onStop() or onDestroy() methods : how can I know how I can here ? I'd like to run some code when I close the Activity (back button), but not if I change screen orientation

View 7 Replies View Related

Will OnStop And OnDestroy Always Get Called

Sep 28, 2012

There are some process manage application that allows user stop any running aplication by a button pressing. I want to know, in these situations, the onStop and onDestroy methods will always get executed?

View 6 Replies View Related

Android :: Saving Dialog State - OnStop Not Getting Called?

Jul 14, 2009

I'm saving the state of my activities for orientation change support, it works well. Sometimes I have a dialog open though and need to save its state as well. My dialog's onStop() method doesn't seem to get called when I change orientation. Where would get notified inside the Dialog that we're being destroyed, so I can save its state?

View 3 Replies View Related

Android :: OnStop Not Getting Called When I Press Back Button

Jul 24, 2010

The docs say "The onStart() and onStop() methods can be called multiple times, as the activity alternates between being visible and hidden to the user"When I press the back button an it will go back to the previous activity which totally covers the old one.What is going on here?

View 1 Replies View Related

Android :: Activity Lifecycle OnStart OnStop Possible?

Oct 5, 2010

In the Android Application Fundamentals it says that after the call to the onStart()-method of the activity lifecycle either the callback method Resume() or onStop() is called. In case of an "normal" Start of an activity the system calls onCreate(), onStart(), onResume().But does somebody know an example where onStart() - onStop() are executed one after another?

View 2 Replies View Related

Android :: Translucent Activity Not Calling OnStop On Exit

Dec 3, 2009

I'm having this strange issue where upon exiting a subactivity that is translucent (android:theme="@android: style/Theme.Translucent" ) the onStop() method doesn't appear to be called. have a TimerTask that runs and is supposed to be terminated when the subactivity ends in the onStop() method, but I'm instead left with an orphaned thread running in the background. It go particularly bad when I ran the subactivity several times. When I revert to no theme, the onStop() method is called and the activity behaves properly. Is there something I missed about how Translucent activities'lifecycles differ from standard activities?

View 4 Replies View Related

Android :: Simple Code I Can Add To OnStop To Stop GPS Activity?

Aug 31, 2010

Just like the title says, Is there a simple line of code I could add to onStop()that will simply stop any gps activity currently going on with my application?

View 1 Replies View Related

Android :: Retain Only One Copy Of An Activity On Stack When Called From Non Activity

Jul 26, 2010

How can I make sure I only retain one copy of an activity on the stack when called from non-activity? When called from an activity I can just add the FLAG_ACTIVITY_REORDER_TO_FRONT flag to the Intent, but how can I do this from e.g. a widget or a notification?

View 1 Replies View Related

Android :: How To Get Calling Activity Instance From Called Activity?

Jul 9, 2010

I have a Contact Activity which is derived from ListActivity, which displays list of contacts, and on click of item, a new Activity Message Activity derived from ListActivity is initialized.Now I know, I can pack some information in Bundle and pass it before creating activity, but is there a way I can get instance of "ContactActivity" in onCreate method of "MessageActivity"?

View 1 Replies View Related

Android :: Does OnActivityResult Get Called When An Activity Is Recreated

Sep 30, 2009

I have a flow A->B->C->D where A desires some information that is obtained by D. B, C, and D propagate the data back through the flow using setResult(RESULT_OK, data) and finish(). All intents in A, B, and C are started with startActivityForResult. However, if B is reclaimed by Android and forced to call onCreate again after C finishes onActivityResult in B is never called and the data never makes it back to A. Is there a way I can be sure that onActivityResult will be called?

View 5 Replies View Related

Android :: Same Activity Called Twice - Multiple AsyncTasks?

May 8, 2010

I have three simultaneous instances of an AsyncTask for download three files. When two particular ones finish, at the end of onPostExecute() I check a flag set by each, and if both are true, I call startActivity() for the next Activity.

I am currently seeing the activity called twice, or something that resembles this type of behavior. Since the screen does that 'swipe left' kind of transition to the next activity, it sometimes does it twice (and when I hit back, it goes back to the same activity). It's obvious two versions of the activity that SHOULD only get called once are being put on the Activity stack.

Could this be from both onPostExecute()s executing simultaneously and both checking the flags each other set at the exact same time? This seems extremely unlikely since two processes would have to be running line-by-line in parallel...

A lot removed from this question since I was way off in what I thought was wrong. Nonetheless I found the answer here quite useful, so I have edited the question to reflect the useful parts.

View 1 Replies View Related

Android :: Image Capture Intent / Activity Not Get Called

Jun 26, 2009

I start an IMAGE_CAPTURE Intent like this, and my activity's onActivityResult() get called: Intent i = new Intent (android.provider.MediaStore.ACTION_IMAGE_CAPTURE, null); i.putExtra("return-data", true);
startActivityForResult(i, PICK_ICON_FROM_CAMERA_ID);
But, if I start my Intent like this, the Capture Image Intent did get called, but my activity's onActivityResult() never get called:
Intent i = new Intent (android.provider.MediaStore.ACTION_IMAGE_CAPTURE, null); i.putExtra(MediaStore.EXTRA_OUTPUT, Uri.parse("file:/" + "MyTestFile")); i.putExtra("outputFormat", Bitmap.CompressFormat.PNG.name());
startActivityForResult(i, PICK_ICON_FROM_CAMERA_ID);

View 3 Replies View Related

Android :: OnPause() Not Being Called For SingleTask Finish()'d Activity?

Feb 17, 2010

I'm not sure why onPause() is not called in the following scenario.

Here's my activity:

CODE:.......................

View 3 Replies View Related

Android : Webview - OnCreate Always Get Called When Activity Comes To Foreground

Mar 29, 2009

I launch my TestWebView activity. After my web page is loaded, I put the app in the background by pressing the Home key. Then I bring the TestWebActivity back to the foreground. Unexpectedly, TestWebView's onCreate() is called when I bring the activity to the foreground. But onDestroy is never called. This same thing happens every time I tested. It appears the old TestWebView was not completely killed so there are possibly duplicate web clients running.

My code: .....

View 7 Replies View Related

Android :: Parent Activity Runs OnCreate Before OnActivityResult Is Called - Sometimes

Aug 5, 2010

The order is:

A: startActivityForResult( B ) B: <dostuff>, call finish() A: onCreate <---- what's this all about A: onActivityResult

This happens for a tiny minority of users. I havn't been able to reproduce or find any common elements. A is the launch activity.

CODE:..............

View 7 Replies View Related

Android : Child Activity Exit By Unexpected Exception - OnActivityResult - Is Not Called

Jun 23, 2010

I have faced with issue about startActivityForResult() and onActivityResult(). If child activity started by the startActivityForResult() exit by unexpected exception the onActivityResult() is not called and I have no any ideas how can I handle this to get application working in a fail-safe manner ?

When my code runs child activity with startActivityForResult() it awaits until onActivityResult() will be invoked to get working further, but onActivityResult() is not calling and my code is "hang- up" (logically).

So the question is how can I handle all possible ways the child activity is finished (normally and by unexpected exception) to get fail-safe code ?

I have check the documentation for this issue but have found nothing relating issue.

View 4 Replies View Related

Android :: Voice Recognition Activity Called In OnCreate Method / Causes App To Load Slowly

Oct 1, 2010

In my android app I call the voice recognition in my onCreate method of my startup activity. I have made it a preference to start up with the voice control or not. However, the app takes about 5-7 seconds to load when voice recognition is on. When it is off, the app starts almost instantly. Below is sample code, I have added Free_Form, max_results 1, and a custom prompt to mine.Why would calling the normal android speech recognition take sooo long to load in my OnCreate method?

View 1 Replies View Related

Android :: On Pause Not Being Followed By OnStop

Oct 7, 2010

I am seeing an issue where when I hit the "back" button, I get the onPause call, but it isn't followed by onStop and on Destroy. On most phones, I see this, but on one particular phone (Droid-X),

View 7 Replies View Related

Android :: OnStop Does Not Affect MediaPlayer

Oct 12, 2010

I have a mediaplayer object inside an activity that plays from mp3 files situated in the res/raw folder. The MediaPlayer.create(Context context, int resid) method is used to create and return a mediaPlayer object to play this track. What I have noticed is that when the activity is obscured by another activity and hence the "onStop()" method is called , the music continues to play. Can anyone explain why this occurs? I though that onStop would essentially freeze any actions taking place by objects associated with the activity, except for services etc

View 1 Replies View Related

Android :: Interactivity Coordination OnStop And OnResume

Oct 16, 2010

I have two activities. One loads all rows from a database, and the other saves to the database. When I have the second save in onStop and the first repull the data in onResume, they do it out of order (the first resumes and then the second saves). I managed to fix this by putting the saving data in onPause, but why was this happening? Was this the cleanest way to do it?

View 1 Replies View Related

Android :: Not Calling OnStop When An Incoming Call Is Received

Apr 28, 2010

I have an application that is silencing the ringer while it is open, then when it closes it unsilences it. Currently I am doing these two things in OnStart and OnStop. The only problem (and it's a big one) is that when a phone call comes in, it stops my application (calling OnStop), then rings at its normal volume. Is there any way to get around this? I tried using onCreate and onDestroy, but I want to restore the original volume setting as soon as the program is closed, which onDestroy doesn't seem to do. 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

View 8 Replies View Related

Android :: Android 1.5 - Asynctask DoInBackground Not Called / Method Called

Oct 26, 2010

I am running into an issue with the way my asynctasks are executed. Here's the problem code:

firstTask = new background().new FirstTask(context);
if(firstTask.execute().get().toString().equals("1"))
secondTask = new background().new SecondTask(context);

What I'm doing here is creating a new asynctask object, assigning it to firstTask and then executing it. I then want to fire off a separate asynctask when the first one is done and making sure it returns a success value (1 in this case). This works perfectly on Android 2.0 and up. However, I am testing with Android 1.5 and problems start popping up. The code above will run the first asynctask but doInBackground() is never called despite onPreExecute() being called. If I am to execute the first task without the get() method, doInBackground() is called and everything works as expected. Except now I do not have a way to determine if the first task completed successfully so that I can tell the second task to execute. Is it safe to assume that this is a bug with asynctask on Android 1.5? Especially since the API says that the get method has been implemented since API 3. Is there any way to fix this? Or another way to determine that the first task has finished?

View 2 Replies View Related

Android :: OnStop And OnDestroy Aren`t Invoked After Calling Finish()

Oct 14, 2010

i`ve got some problems with finish() method. I expect what after calling on my Activity finish() method onStop and onDestroy must be triggered(or am wrong??), in majority of examples they are, but Scenario: - reboot phone - launch activity - invoke finish() onPause is triggered but afterwards they are no calls to onStop() and onDestroy()I`ve noticed, that those calls are triggered after launching any other activity.

View 7 Replies View Related

Android :: How To Save Value OnDestroy Or OnStop / Program Launches Back Again?

May 6, 2010

I wonder if I could save a value (in my program its an index) so I could call it back when the program launches back again (even if the program destroyed) and the user could start from where finish.

View 2 Replies View Related

Android :: How To Called Mp3 Download?

Jun 4, 2010

I was reading through app suggestions and someone mentioned an app called mp3 Download that basically functions like limewire, letting you search and download mp3's to your phone. Does anyone know anything about this app and whether it is good or not? Or have suggestions for a similiar app? It had mixed reviews at appbrain and when I searched here it came up with a bunch of other threads.

View 4 Replies View Related

Android :: An App Called Listen?

Sep 22, 2010

I was told by a few friends that the iphone has an app that allows you to hold your phone up to a song that you dont know and it tells you the name.Does android have anything like that?

View 6 Replies View Related

Android :: OnKeyDown Not Always Called In App

Oct 20, 2009

I've created a simple android game, based on the Lunar Lander sample, and I'm having a problem with handling key events.When the activity starts, the only keys that onKeyDown or onKeyUp get called for are the dpad up/down/left/right keys.Neither the menu, back, or dpad_center keys trigger onKey methods. However, once I've pushed one of the dpad up/down/left/right buttons, pressing the menu, back, or dpad_center keys do trigger these methods. I'm not getting any errors, or any indication of what's going wrong.It's possible that the focus is set wrong - the activity is started from a button on screen, so it could be in touchscreen mode. If that's the case, shouldn't touching the back button get me in to the right focus mode so that I can catch the event?I'm using the emulator from SDK-1.5r3.I have not been able to try this on a real phone yet.

View 4 Replies View Related

Android :: Whats That App Called?

Aug 27, 2010

I saw it on the market but forgot to install it. It displays the number of remaining minutes, texts and data left for the month if your on a monthly mobile phone plan.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved