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..............

Android :: 1.5 and 1.6 after calling finish activity and home button


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 :: 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 :: 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 :: Finish Activity When Home Pressed?

Mar 25, 2010

I saw another thread related to this question, but did not find the answer that was useful to me. Is it possible when the user presses the Home button to be able to finish() my activity somewhere? I saw that people were having problems with using onStop(). Has anyone found a resolution to see if this is always called on Home being pressed?

View 5 Replies View Related

Android :: How To Override The Back Button So It Doesn't Finish() My Activity

Jun 29, 2010

I currently have an Activity that when it gets displayed a Notification will also get displayed in the Notification bar.

This is so that when the User presses home and the Activity gets pushed to the background they can get back to the Activity via the Notification.

The problem arises when a User presses the back button, my Activity gets destroyed but the Notification remains as I want the user to be able to press back but still be able to get to the Activity via the Notification. But when a USER tries this I get Null Pointers as its trying to start a new activity rather than bringing back the old one.

So essentially I want the Back button to act the exact same as the Home button and here is how I have tried so far:

CODE:.........

However the above code still seems to allow my Activity to be destroyed, How can I stop my Activity from being destroyed when the back button is pressed?

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 :: Android - Override The Back Button So Doesn't Finish - Activity

Jun 29, 2010

I currently have an Activity that when it gets displayed a Notification will also get displayed in the Notification bar.

This is so that when the User presses home and the Activity gets pushed to the background they can get back to the Activity via the Notification.

The problem arises when a User presses the back button, my Activity gets destroyed but the Notification remains as I want the user to be able to press back but still be able to get to the Activity via the Notification. But when a USER tries this I get Null Pointers as its trying to start a new activity rather than bringing back the old one.

So essentially I want the Back button to act the exact same as the Home button and here is how I have tried so far:

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

However the above code still seems to allow my Activity to be destroyed, How can I stop my Activity from being destroyed when the back button is pressed?

View 2 Replies View Related

Android :: How To Control Activity Flow - Back Button Versus Home Button

Sep 2, 2010

I have 3 activities in my app: Activity1 -> Activity2 -> Activity3. Inside Activity3, if the user presses Back, I would like to return to Activity2. In Activity3's onPause event, I added a finish() statement. That's probably not even necessary, but I wanted to make sure this Activity gets cleaned up. This works fine.
However, while in Activity3, if the user presses Home or starts a new app (through notification bar or some other means), I want both Activity3 and Activity2 to finish. If the user returns to this app, he should resume with Activity1.

I have figured out how to do one or the other, but I can't figure out how to handle both cases, if it's even possible. Can I trap the "Back" button in Activity3 and send a message back to Activity2 telling it not to finish()? It seems like the Activities follow the same lifecycle flow (Pause, Stop) regardless of what you do to send them to the background. Just to answer the question of why I want this behavior, imagine that Activity1 is a login screen, Activity2 is a selection screen, and Activity3 is a content screen. If I press Back from the content page, I want to be able to make a new selection. If I exit via any other means (Home, notification bar), I want the user to be "logged out".

View 2 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 :: 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 :: 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 :: Home Button Not Resuming Last Activity

Sep 23, 2010

I am trying to solve an issue sort of similar to what was done here (link text)Except in my case where Activity A, started Activity B, started Activity C, when the user resumes the app after pressing the home button - I want C, the last Activity, to be displayed. Instead what is happening is I am back to A.Also on a side note I have discovered that even when I exit the application, if I hold down the Home button, my app is still listed as an active app even though in the LogCat I can see that it exited OK.Also, in case it matters, I did recently add android:launchMode ="singleTask" in order to make some notification logic work correctly. I was seeing the Home button behavior before that though.

Activity B actually has several Activities that it chooses from (it has a list of Intents) to display based on input it receives but launches them all the same way as Activty A launched B. Once the first Activity is displayed the user swipe the screen to navigate to the left or right screen. When the user swipes left or right, the current activity puts info in its return Intent that Activity B uses to display the next Activity. Also since logic outside of the user's control could prompt a change in the screen displayed, each Activty calls finish on itself in onStop to avoid back-button issues.

View 2 Replies View Related

Android :: Home Button - Does Not Show The Last Activity

Jan 23, 2010

I'm experiencing kind of strange behavior of my application after hard Home button is pressed. When you press Home, everything is OK - my app goes to the background, showing Home screen. But if you try to choose my app in the main menu or in the list of last tasks it behaves like it was not started before and does not show the last activity you were on - it just starts from scratch, namely, shows the splash screen and starts next corresponding activities. Moreover, old activities of this app remain on the activities stack, and previous instance of the app is not terminated - so if you press Back for a few times you'll just run into those activities which were undoubtedly started during the previous session of work with my app. Splash screen activity is filtered by "android.intent.action.MAIN" filter and "android.intent.category.LAUNCHER" category. The strange thing is that all of that happens despite the fact that I do not intercept any Back key hits, or override any onPause or onResume methods. What's happening contradicts with my understanding of Android app lifecycle - I was sure that when you hit Home an app just goes to the background, and when you choose it in the menu later - it just unwinds and does not start anew. (Of course, unless stuff like that is stated in the app manifest or corresponding methods are overridden or something else). I also checked it for some other lifecycle events - such as changing orientation or flipping hard keyboard out - and none of those led to such strange results. It appears that the problem occurs when you try to start the app from main menu or menu of last applications.

View 1 Replies View Related

Android :: Finish Any Previous Activity In Stack From Current Activity?

Apr 27, 2010

How to finish any previous activity in application stack (at any level , I mean not immediate parent) , from current activity like on some particular event I want to invalidate this previous activity?

View 1 Replies View Related

Android :: Exit Current Activity To Homescreen (without Using Home Button)?

May 3, 2010

What I am trying to do is emulating the "Home" button which takes one back to Android's homescreen. So here is what causes me problems: I have 3 launcher activities. The first one (which is connected to the homescreen icon) is just a (password protected) configuration activity. It will not be used by the user (just admin) One of the other 2 (both accessed via an app widget) is a questionnaire app. I'm allowing to jump back between questions via the Back button or a GUI back button as well. When the questionnaire is finished I sum up the answers given and provide a "Finish" button which should take the user back to the home screen.

For the questionnaire app I use a single activity (called ItemActivity) which calls itself (is that recursion as well when using intents?) to jump from one question to another:

Questionnaire.serializeToXML();
Intent i = new Intent().setClass(c, ItemActivity.class);
if(Questionnaire.instance.getCurrentItemNo() == Questionnaire.instance.getAmountOfItems()) {
Questionnaire.instance.setCompleted(true);
} else Questionnaire.instance.nextItem();
startActivity(i);

The final screen shows something like "Thank you for participating" as well as the formerly described button which should take one back to the homescreen. But I don't really get how to exit the Activity properly. I've e.g. used this.finish(); but this strangely brings up the "Thank you" screen again. So how can I just exit by jumping back to the homescreen?

View 2 Replies View Related

Android :: State Of Activity Saving When Home Button Pressed

Oct 24, 2009

I am having an issue related to home key . when i press home key all current activity gets hidden. but when i press the executable it again starts from the fisrt screen . I have overidden all methods nsaveInstaceState opPause onStop onResume

but there are still issues what is the right way to handle those conditions. When i am pressing home button i am storing the widgets state in database and when i again click the exectable i am checking the database state and starting the new Intent as saved when user presses the home button .Is it the right way to do that as i am facing the problem when user does the same and again presses the back button , there is already on intent available in stack of activity .

View 2 Replies View Related

Android :: How To Close An Activity When User Clicks On Home Button

Feb 19, 2010

I understand that trying to capture home button clicks is a hack, but I need to atleast close my current activity when the user clicks on home button. Is there anyway I can tell the system to close this activity is the user clicks on home button? If so how can I do that? I need to do it as I am listening for location updates and I want to stop the updates and also need to trash any location that was available to me previously. I need to do this just in case any user while in that activity clicks on home button and changes the location settings.

View 7 Replies View Related

Android :: Finish Activity Not Started From Current Activity

May 1, 2010

I have following problem with my application: From my main activity ("activity 1"), there is a menu from which user can launch an action. This action will result in an Intent being received by a BroadcastReceiver, defined in my application. Finally, this BroadcastReceiver will start an activity ("activity 2") to deal with this intent.

The problem is that I have a "quit application" entry in my menu, and I can only finish() currently active activity. ie I am not able to finish "activity 1" from the menu of "activity 2". And I can't use startActivityForResult() as "activity 2" can't be started from "activity 1". Any suggestion would be much appreciated Thank you very much guys, regards.

View 4 Replies View Related

Android :: Activity State On Pressing Back And Home Button On Screen

May 6, 2009

Whenever I press the home button when Im in the root task of my application and when I click on the icon of my app again the state of my task (activity) is retained, but when i press the back button on the emulator and when I open my application its state is not retained. I want the state to be retained in both the scenarios.

In the mnifest I have given the below entries,

android:alwaysRetainTaskState="true" for the root activity

android:launchMode="singleTask" for the application

View 2 Replies View Related

Android :: Home Button On Samsung Galaxy Tablet Is Causing My Activity To Re-launch

Nov 22, 2010

On my droid phone, I get what I consider a proper pause/stop/resume/restart sequence when the home button is pressed and I then select my application. However, I'm testing on a new Samsung Galaxy tablet and when I select my application after having pressed the home button, a new activity is being launched. I do not understand why the behavior is different on the Galaxy. Any ideas? I have removed orientation config changes in the manifest, so it's not that.

View 1 Replies View Related

Android :: Launch The Same Activity From Widget With Different Extras - Prevent Same Instance Show Up After Returned From HOME Button?

Nov 5, 2010

I have a widget that contains 4 buttons to show 4 stock prices, each of them will launch into the same activity Quote.class to show stock details. In onUpdate(), it will set up the pendingIntent with extras with stock symbol. After I hit button A, it goes to Quote activity that shows stock A. Then I hit the BACK button to the homescreen, Quote activity calls onDestroy() and when I hit button B, stock B will show properly. However, when i hit HOME button after it shows stock A, the Quote activity only calls onStop without calling onDestroy(), then as i hit button B, it will call onStart() and it shows the same instance that shows stock A.

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

Originally I thought adding a flag in the Intent should solve this problem. But I have tried
i.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK or FLAG_ACTIVITY_NEW_TASK or FLAG_ACTIVITY_NO_HISTORY), none of them makes any difference.

So is there any ways to make it work? How can i remove the history stack from HOME button? How can I call onCreate in Quote activity and get new extras when i hit button B?

View 4 Replies View Related

Android :: Finish Activity From Other Activity

Oct 8, 2010

I am having application in which i am using menu , on tap on menu item i am redirecting to specified activity. I want to make sure that when i am redirected to another menu item my current all activity should be finished to reduce the stackflow of the activity and better performance. So when i tap on back from my tapped activity from the selected menu activity i should be redirected to another activity and finish current activity. So i am wondering is there any way by which i can finish another activity from my current activity. Or should i override the OnKeyDown Method..

View 1 Replies View Related

Android :: How Finish An Activity In This Instance

Aug 16, 2010

We all know that hitting the back button on the device doesn't kill the application, it merely finishes (destroys) the activity running on the foreground.

Well I have come across some code which helps me capture the back button signal so that I cannot exit the application. The only way to exit it in such cases is to press the home key.

Now this situation presents me with a unique disadvantage! The inability to kill finish the application on a time of my own choosing allows the application to keep running in the background like nothing has changed.

So in such cases is the task manager my only friend or is there a way for me to otherwise kill this application?

View 2 Replies View Related

Android :: Activity Pause Rather Than Finish?

Nov 30, 2009

I see no means by which my activity can pop itself off the activity stack to return the user to the one he was using before it was invoked. Is there one? My purpose is that my app has some data structures built from data provider queries that take 5-15 seconds to assemble and I don't want a lot of latency if it is used in a few one-shot purposes in rapid succession. I'm more than willing to let the system ask my app to die, but I'd like to keep warmed and ready otherwise.

View 4 Replies View Related

Android :: Wait For Activity To Finish?

Sep 7, 2010

I have one activity call a camera view activity, and in the onActivityResult, I have it start that activity again with different parameters. Android doesn't seem to like that, and gives me an error that the camera is not available if I start it right after it returns. I tried just waiting a few seconds, but this doesn't seem to work on all phones, and it sometimes crashes. Is there some way to wait until that activity finishes properly, and gives up all resources?

View 6 Replies View Related

Android :: Finish Not Killing Activity

Apr 12, 2009

I've got an application that has (among other things) three Activities, let's call them A, B, and C. A is the main navigation point for the entire application, and launches B and C directly using startActivity(). They work fine that way. However, when I call C from inside B, I get a strange problem. The code for launching Activity C is exactly the same in both places. The problem is the hardware back button. In the emulator, it takes two presses of the back button in order to close Activity C and come back to B. On a G1, it takes 3 or 4 presses. Upon seeing this, I implemented the usual suspects in C - onPause(), onStop(), and onDestroy(), and onResume() in B. When I press the back button from C and it doesn't work, I get onPause(), onStop(), onDestroy () - in that order, but nothing happens. When it works (on press 3 or 4 on the G1), I get onPause(), then onResume() in B, then onStop() and onDestroy().

I've tried catching the key press of the back button and calling finish (), but that doesn't make a difference. Has anyone seen this? To pre-empt some questions: All C does is display some data. There are no threads or any other special resources that C might have an active handle to that's preventing it from closing. But out of curiosity, if it did, how would I detect that? Any ideas for further diagnostics here?

View 12 Replies View Related

Android :: Finish() Won't Close Activity

Jul 23, 2009

I have an EditText field and I want to pop up a new window/activity whenever a user touches/clicks the field. The new window has some widgets and of course Apply and Cancel buttons. Here is the code how I intercept the onTouch event.

EditText ctlMaskEt = (EditText)findViewById(R.id.mask_field); ctlMaskEt.setOnTouchListener(new OnTouchListener() { public boolean onTouch (View v, MotionEvent event) { popMaskEditor(); return true; } });

Everythings work fine until I click the Apply and Cancel buttons. The API finish() won't close the new window unless I click the same button one more time. Calling popMaskEditor() from a button's OnClick event handler doesn't have this problem.

View 2 Replies View Related







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