Android :: Close Browser And User Back To App Programatically?
May 12, 2010
I need to launch the Browser from my application (cannot do the WebView - it has to be browser), and once I'm done with the browser, is there a way to close the Browser and the user back to the application programatically?
The problem is that user will probably press back or home keys to get out of the browser - back key will not work, and home key will put Browser and my app in the background.
I hopped that a button in the HTML displayed would close the browser but it seems like the Android seems to ignore that. Can anyone help?
I call WebView.clearHistory(), but I am still able to go back after doing so. I want to reuse a WebView, but I don't want the back button to allow the user to go back further than the current "session" of using the WebView. Anybody know what is the best way to handle this? I thought for sure that clearHistory() would do it.
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.
When I use the default web browser and get finished I can find no where to close it. I just hit the home button to get out of it, but I am sure that leaves it running. So, how do you close out of it and shut it down?
So I read through the SDK docs and I thought that calling a new activity(browser) as part of a task (myTask) will mean that activity* (browser) will close when a user closes the task (myTask) But I am left with a browser window.
Here is my scenario (in sudo code);
Question 1: What is the cleanest way to ensure that when a user closes my app, any outside activities called will be closed to.
Question 2: Does a callback URl start a new Task, or use one in the stack if available?
I have purchased a couple of games from the android market, says purchase complete but then wont install, also when I turn phone on keep getting a message about sony application user support has stopped and it needs to be forced close?
Visiting www.google.com on the Android browser (or even with an android spoofed user-agent), presents the option to "Share Location". When clicked, it uses the GPS/Cell phone towers to figure out the location. I tried the google.loader.clientLocation but that only works using the IP address. Is there a method to tap into the Android OS and access GPS data from a regular web application (and not an Android application) similar to the way Google does? [Perhaps Google uses the Google Gears app on Android to access this data.]
Sometimes, after the phone has been in sleep mode for awhile, when I hit the power button to wake it back up and then the menu button (or swipe) to open the screen, I get that circular bar pattern followed by what look like the browser trying to launch. The screen is white, with a white address bar area, too. Then that screen goes back to the circular bar pattern, followed by the white browser screen again, after which it just closes. Very odd. Doesn't do it all the time. Seems to be random. And after a hard reset, sometimes the first time or two I use the browser, it just force closes on me. Again, doesn't do it all the time. (At first I thought I accidentally hit the home button, or something, but I didn't.)
I have an activity that contains several user editable items (an EditText field, RatingBar, etc). I'd like to prompt the user if the back/home button is pressed and changes have been made that have not yet been saved. After reading through the android documentation, it seems like this piece of code should go in the onPause method. I've tried putting an AlertDialog in the onPause however the dialog gets shown and then immediately tears down because nothing is there to block the pause from completing.
i am new to android. i am showing Intent.ACTION_DIAL when my application starts..but when i clik back button it shows a activity page and again press back button it finishes the activity.i want when application starts dialler shown and if user cliks back button it calls finish() method
My MAIN activity is spawning a child activity that contains a ListView. While this ListView is being populated (through an AsyncTask), an indeterminate progress bar is shown.However, assuming that I am an impatient user and I press the BACK button, the progress bar is cancelled but I am left with a blank screen. I have to press BACK one more time to go back to the MAIN activity.I would like the app to go back directly to the MAIN activity by pressing BACK only once. Can somebody point me in the right direction? I am thinking I should call finish() somewhere but I don't know where to put it.
I looked around and although there are many related questions I didn't see one that answers my exact question:
I would like to create an app that runs in the background that provides the exact same functionality as the hard coded 'Back' button in all cases.
The reason? I (for example) have a Droid X, and it is BIG. it makes it extremely hard to use one-handed and having a swipe gesture function as a back button (like in Palm Pre for example) would greatly increase the ease of use.
as far as I'm concerned the app could just be one simple class that contains: 1) a listener for the 'back' swipe 2) a call to the physical hard button itself
Is this possible? are there built in APIs for the hard coded buttons that would allow me to call them without actually pressing them?
Again - I'm not interested in overriding the button, I'm interested in making a software call to it - or failing that, in emulating it's behavior in any and all states and other apps!
Please forgive the naivete of this post. I am a very novice programmer and really I just want to know whether this is possible before I start to devote myself to trying to build it.
Well I have issues. I always think that my phone isn't running the way it should or could. I have installed many apps and uninstalled a couple. But I have noticed that my browser will force close about every other time I use it.
Ok, I have had a Motorola Droid since they released the phone and my battery has been great. I could charge it overnight and take it off the charger around 6:30 am and when I put it back on the charger around 9 - 10 pm at night I would still have anywhere from 50% to higher battery life and this is after very heavy usage.
Beginning a few days ago I noticed that my Droid battery indicator is showing almost completely drained out by 6 pm and I really used my phone lightly yesterday and today. Today and yesterday both, the red LED was blinking and the battery indicator was showing almost completely dead by 6 pm. I pulled up the battery usage on the phone and it is showing the 'browser' as the biggest battery hog for some reason. Today it was showing 81% of the battery usage was from the browser. I hardly, if at all, used the browser today. I also checked the firmware version and it is showing 2.0.1, which I never updated it myself.
Are there any suggestions about why the browser would be draining the battery down so bad, when the browser has not even been used? Is there a way to close out the browser so it doesn't continue sucking the battery dry, besides using an app killer program?I did search the forum and did not see a specific question/answer to my question. I know I had read that some people were seeing battery issues after upgrading to 2.0.1, but I did not upgrade my phone, it must have done it.
First of all, maybe i went about this the wrong way in the first place. Situation is, i have a listview that when an item is clicked, it creates an intent and calls startActivityForResult() to another activity, to be able to edit the entries in the row. and that other activity after editing the required values, returns back to the calling activity, when the user clicks on a save button. The activity then uses the row Id to update the item.My problem now is that, if the user presses the BACK button instead, the application crashes. i have been looking around and see solutions like using Shared Preferences or onSavedInstanceState(), but i don't know where exactly i should be putting the code?
I have an application with 2 activities, LogonAct and MainAct. LogonAct is a logon activity which I want to force the user to go through each time they return to the application. I've set android:clearTaskOnLaunch="true" on LogonAct.