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.

Android :: OnStop and OnDestroy aren`t invoked after calling finish()


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 :: 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 :: 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 :: 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 :: Service Dies Without Calling OnDestroy

Dec 15, 2009

A service is setup by an activity with startService(service_intent). This service is meant to run 24 hours a day. After some amount of time, 5 or 6 hours sometimes but its not predictable, the service is killed.In the database log, the destroyed message does not show up and the notification #1 is not cancelled. Android makes no attempt to restart the service. The database log will show the startup of the replacement service if I trigger it by visiting the activity. What can I do to keep this service running or at least get it restarted by android automatically?

View 6 Replies View Related

Android :: App Does Not Quit On Calling Finish() / What's Cause?

Apr 28, 2009

I have been developing a game on Android and wrote a wrapper for J2ME classes,

When notifyDestroyed() is called in my ME program and calling finish() but the application doesn't close correctly.

The App goes to background and when launched again it shows an error message and presents an option to "force close" the App, if i force close it and launch again, the app launches fine but again the same has to be repeated upon every launch..

Can you please explain why the App is not being erased from memory when finish() is called.

when i check the log i found no exceptions when closing but when launched again it throws a null pointer exception.

for now to work around I placed "System.exit(0)" after calling finish () so that the app is exited abruptly, but am waiting for a valid answer on whats going on behind...?

View 9 Replies View Related

Android :: Calling Finish() In OnResume()?

Sep 8, 2010

I've been using code like: activity.finish(); activity.startActivity(new Intent(activity, activity.getClass()));

in two places: onResume(), and in an onClick() method of an AlertDialog. I'm getting the desired results when the code is called from onClick(), but I get mysterious null pointer exceptions while the runtime is trying to execute my onPause(). Is calling finish() from within one of the Activity lifecycle callbacks always a bad idea?

This code makes me nervous even though it works in the onClick(). After I call activity.finish(), I would think activity is in a questionable state by the time activity.startActivity() is invoked. Seems like an invitation to race conditions.

My use case is setting UI preferences (e.g. a different layout) in a PreferenceActivity. When I return to the main activity's onResume(), I check for preference changes and if a new layout is requested, I use the code snippet above.

View 10 Replies View Related

Android :: Calling Finish() After Starting A New Activity

Apr 26, 2010

The first Activity that loads in my application is an initialization activity, and once complete it loads a new Activity. I want to ensure if the user presses 'Back' they go straight to the Launcher, and not the initialization screen. Side note, is this even the best approach, or would this be better done with some kind of Intent Flag?

Is it correct to call finish() after calling startActivity() on the new activity?

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

I'm still taking in the whole 'Message Queue' method of doing things in Android, and my assumption is that calling startActivity() and then finish() from my first Activity's onCreate() will log each respective message in the message queue, but finish execution of onCreate() before moving on to starting the next Activity and finishing my first one. Is this a correct understanding?

View 1 Replies View Related

Android :: 1.5 And 1.6 After Calling Finish Activity And Home Button

Jan 12, 2010

I open splash screen at the end i call finish() then i moved to browse page. At the browse page when i click on home button it hide the application.(b/c of Android's Multi tasking feature) When i go to Android's desktop launch application again it starts from splash screen. Android Platform 1.6

I open splash screen at the end i call finish() then i moved to browse page. At the browse page when i click on home button it hide the application.(b/c of Android's Multi tasking feature) When i go to Android's desktop launch application again it always starts from browse screen instead of splash screen why is that..............

View 1 Replies View Related

Android :: When Does Activity Object Really Get Killed After Calling Finish()

Nov 5, 2010

I created a thread in my activity, and that thread will print out the value of my instance variables in my activity after running for about 10 seconds. I pressed the back key to destroy my activity before the thread prints out the values, and when the thread reaches that line of code, it can still print out the values correctly. That means even though the activity is finished, the java object of the activity is still there. Will the object always be there? Or it is just waiting to be GCed? Or it will be killed only when Android needs memory?

View 2 Replies View Related

Android :: Shouldn't Calling FinishActivity Cause Finish To Be Called?

Nov 11, 2010

I have overridden the finish call in a sub-activity like so

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

I am calling finishActivity on this sub-Activity from the Activity that started it for result. But I am not seeing the finish being hit. Instead it goes directly to onPause.

View 2 Replies View Related

Android :: Return To Previous Activity Without Calling Finish() / Save This Information?

Oct 26, 2009

I have an android application with a LOT of activities, think of something like a book where every page is a new activity. The user can make changes in each activity, for example highlight certain texts with different colored markers etc. and it's crucial that I'll remember this information as long as the application stays alive (and I don't want/need to remember any of this when it's not). As I understand the best mechanism for storing this kind of information is via onSaveInstanceState(Bundle outState) and onCreate(Bundle)/onRestoreInstanceState(Bundle) rather than lets say, the Preferences mechanism. My only problem is that the user can navigate backwards to previous pages (Activities) and the only way i know of achieving this is by calling finish() which of course kills the current activity without calling onSaveInstanceState(Bundle outState) and even if it did call it, the next time I would launch an activity representing that page it would be an entirely new instance. So my question is: Is there a way to go back to the previous activity without calling finish()? or, is there a better way to save this information? maybe through static variables?

View 1 Replies View Related

Android :: Insufficient Memory Error When Launching Application For Second Time After Calling Finish - In Main Activity

Apr 21, 2009

I have made a game with just one activity.. I just replace the views when I want to change screen. The game runs fine for a really long time inspite of what ever I do within the game.

But once I close the main game, by calling finish on the only activity in the application, and then when I start again, within the next 30 secs it crashes telling VM budget exceeded..

When I don't have a dispose() or a delete method in JAVA.. how the, am I supposed to remove the objects used in memory.. moreover I have android:launchMode="singleInstance" in my manifest

View 4 Replies View Related

Android :: Activity Finish Method Waits To Finish?

Aug 14, 2010

With this sample code, the activity is told to finish, but continues execution afterwards and displays the message. I'm trying to understand why this happens. The only fix I can think of is to place 'return' after finish.

public void someMethod() {
if( valueIsTrue) {
startActivity(new Intent(this, NewActivity.class));
CurrentActitivy.this.finish();

// return; // if uncommented, Toast doesn't show
}
Toast.maketext(this, "Some message", Toast.LENGTH_SHORT).show();}

View 1 Replies View Related

Android :: OnListItemClick() Not Getting Invoked On Using CustomAdapter

Apr 12, 2010

I was trying to use a ListActivity which uses a custom Adapter. Every list element is a complex collection of objects which include buttons, checkboxes etc (which also have onClickListeners). Now, the problem is the onListItemClick is not even invoked when a list element is selected. I tried everything possible but am not able to get the selection. Using the trackball I am able to bring focus to the list elements, but am not able to get the call back. But, on touching, I am not even getting the focus. I tried these steps unsuccessfully to solve the problem. * Tried removing onClickListeners from the listElement Objects. * Tried making all the objects non-focussable, by modifying the XML (as suggested by Romain Guy).

View 3 Replies View Related

Android :: ListActivity OnListItemClick Not Being Invoked

Sep 18, 2009

Scoured the docs and forums, couldn't find an answer or reason why this is happening: I have a class that extends ListActivity and a View coming from XML for each row that looks like this:

<LinearLayout ...> <TextView ... /> <TextView ... />
<CheckBox ... /> </LinearLayout>

When I click on one of the items in the list, the onListItemClick() i have in my activity is not invoked. Turns out, if I comment out the CheckBox node in my layout xml, it works. I feel like there is a simple explanation that I don't know about.. maybe because CheckBox is an actual interactive widget it's overriding some click action or something?

View 2 Replies View Related

Android :: Method Invoked On Main UI Thread

Jul 19, 2010

Say that a user clicks on a Button. Is the resulting onClick() function invoked on the main UI thread of the activity?

View 1 Replies View Related

Android :: First 6 ListView Elements Are Continuously Being Invoked With GetView

Aug 18, 2010

When I check my logs, when using ListView, I see, that getView() method of a custom adapter is continuously invoked on first 6 elements, even if I scroll to the very end of the list.

View 1 Replies View Related

Android :: 1.6 SDK Level 4 Project / Receiver Intent Filter Never Invoked

Apr 4, 2010

I'm trying to get a BroadcastReceiver invoked when the screen is turned on. In my AndroidManifest.xml I have specified:

<receiver android:name="IntentReceiver">
<intent-filter>
<action android:name="android.intent.action.SCREEN_ON">
</action>
</intent-filter>
</receiver>

However it seems the receiver is never invoked (breakpoints don't fire, log statements ignored). I've swapped out SCREEN_ON for BOOT_COMPLETED for a test, and this does get invoked. This is in a 1.6 (SDK level 4) project. A Google Code Search revealed this, I downloaded the project and synced it, converted it to work with latest tools, but it too is not able to intercept that event.

http://www.google.com/codesearch/p?hl=en#_8L9bayv7qE/trunk/phxandroid-intent-query/AndroidManifest.xml&q=android.intent.action.SCREEN_ON

Is this perhaps no longer supported? Previously I have been able to intercept this event successfully with a call to Context.registerReceiver() like so:

registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// ... }
}, new IntentFilter(Intent.ACTION_SCREEN_ON));

However this was performed by a long-living Service. Following sage advice from CommonsWare I have elected to try to remove the long-living Service and use different techniques. But I still need to detect the screen off and on events.

View 1 Replies View Related

Android :: How Can Write Broadcast Receiver That Will Be Invoked When User Clicks On Any Application Icon

Mar 18, 2010

How can I write a Broadcast Receiver that will be invoked when user clicks on any application icon?

I tried by writing:

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

But it is not called.

I tried, by using Packagemanager I will get ApplicationInfo. From that I can know all the application starting activity name and package names. I thought I can use them to registerReceiver and my receiver will listen by its launching activity and package name.

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 :: 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?

View 3 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 :: 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 :: 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 :: 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







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