Android :: Android - Override Back Button To Act Like Home Button

Jan 4, 2010

On pressing the back button, I'd like my application to go into the stopped state, rather than the destroyed state. In the Android docs it states: not all activities have the behavior that they are destroyed when BACK is pressed. When the user starts playing music in the Music application and then presses BACK, the application overrides the normal back behavior, preventing the player activity from being destroyed, and continues playing music, even though its activity is no longer visible


How do I replicate this functionality in my own application? I think there must be three possibilities.

1) Capture the back button press (as below) and then call whatever method(s) the home button calls...........

Android :: Android - Override back button to act like home button


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 :: 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 :: 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 :: Changing Back Button Press To Home Button Press

Sep 1, 2009

Trying to the do as the title describes with the following code, but it doesn't seem to work. It just does nothing once i have altered the keyCode. Do i have to do something to the event?
..............

View 8 Replies View Related

Android :: Using Any App And Press Home Button Home Screen Blacks Out - 10 Sec Delay Get All Icons Back

Mar 30, 2010

Whenever I am using any app and press the home button, the home screen blacks out for a few secs and it takes around 10 sec to get all the icons back and before I can start using my phone again. I am using a non rooted mytouch 3g.

This problem does not happen if I exit an app by pressing the back button. It becomes very annoying at times.

View 7 Replies View Related

Android :: Back Vs Home Button

Jul 4, 2010

This has been brought up before, but I was unable to find a satisfying answer. And I know it's a newbish question.

What is the difference between exiting an app with the back button compared to the home button? I am not talking about switching to the home screen, I am talking about a scenario when you want to exit an app. For example, you play a game, you're done - do you press home or back? Or, you're in the Facebook app and you want to exit to the homescreen - what do you press - back or home? At first, I thought both buttons do the same with the difference that home brings you to the homescreen instantly while back goes through your previous steps/pages/screens in the current app and then returns you the homescreen.

But later I noticed that 'reactivating' some apps that were exited via the back button cause them to 'reload' (the loading screen shows up - with certain games, grooveshark's loading screen, etc.) while they switch back instantly when "exited" with the home button.

I gather the way to 'leave' an app you don't plan on using for at least a short while (I am not talking about closing the app, I know it's up to Android, or some task-killer) is the back button, while home is more for task switching/starting new apps while old ones are running.

View 8 Replies View Related

Android :: Count Down Timer Back Button Vs Home

Jun 25, 2010

I am writing a count down timer, using .postdelayed(), that speaks each second as the timer goes down to zero. I have trouble understanding the consequences of the user hitting the back or home button.

The countdown continues when hitting either button. When home is pressed and you reclick the app, it goes back to the same count(this is what i always want) and continues to count down. When you hit the back key and then reclick the app, you get a new clock that has not started but I still here the sounds from the original timer. How can I code an app so it only can have one instance and chicking the app icon will always go to the active version if it is running?

View 1 Replies View Related

Android :: Stop Playback On Home Or Back Button

Sep 12, 2010

When I press back or home in my application, it hides, but the MediaPlayer keeps going. Is there a way to know when these buttons have been pressed and stop playback before closing?

View 2 Replies View Related

Android :: Create A Soft Home - Back - Menu Button

Nov 9, 2009

I am working on a device that does not have a hardware Home, Back or Menu button. I am trying to create a soft keyboard with only these three keys but I have not been able to get it working. Does anyone have any insight into my problem?

I first looked into injecting keypresses into a WindowManager but this functionality seems to have been removed.

I then looked at creating a custom soft keyboard but that will not work either. Custom soft keyboards only inject their input into the text fields they are attached to. I can't send a Home, Back or Menu keypress to the Android system.

I finally got the Home button working by using this intent to tell Android to go to the Home screen: Intent HomeIntent = new Intent(); HomeIntent.setAction(Intent.ACTION_MAIN); HomeIntent.addCategory(Intent.CATEGORY_HOME);

Unfortunately, I have not found an Intent to send for Menu and Back.

View 2 Replies View Related

Android :: How To Block The Dial - Home - Back And End Call Button

Sep 23, 2010

I would like to know how could i block the dial, home , back and the end call button on an android device.

I know this is possible because there is an application : TheftAware which does block all the buttons so they have no effect at all.

And I also would like to know how to make a dialog window or any kind of window which would stay on top no matter what (this is also done in theftaware).

They are also able to block(hide) the call screen... does someone know how are they doing that ?

Does all this means that android is not that secure after all ?

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

HTC EVO 4G :: Home And Back Button

Jun 14, 2010

Does simply pressing the back or home button actually close the the running app? If I press the back button in mail for instance the phone returns to the home screen but if I then press the Mail button again the mail will open rite where I left off at not on the Mail home screen. this happens with all the apps.

View 1 Replies View Related

Android : When Click On GDE And Click The Home Button - Switches Back To Stock Home Screen

Dec 19, 2009

When I DL'd the GDE app, I accidentally set my stock droid "HOME" screen as the default screen when the popup box came up asking me to choose between stock Home and GDE. Now when I click on GDE and click the home button, it switches back to the stock Home screen. How to I switch the settings now to set the GDE app as the new home screen?

View 15 Replies View Related

Android :: Ok Button On AlertDialog Should Work As Back Button

Jun 16, 2009

In My code I am displaying a AlertDialog based on some condition.

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

View 2 Replies View Related

HTC EVO 4G :: Home Button - Takes Back

Aug 3, 2010

As an avid user of ADW and Launcherpro, I encountered some problems after the update to 2.2. For instance, If I switch to LauncherPro, and set it as default via "Home Switcher", the next time I hit the home button it still takes me back to Sense. The solution I found is this:

1. You cannot use Home Swithcer.
2. After uninstalling Home Switcher, go to Settings> Applications> Manage Applications.
3. Click the tab to show all, navigate to "HTC Sense", clear it's defaults.
4. Now, the next time you hit Home, it will ask what to do. Select the launcher of your choice and make it default.

From here out, you can use Home Switcher to launch a different launcher, but know that the "Set Default" action will not work for 2.2. You will have to clear default for whatever launcher in order for home to function properly for whatever launcher you choose.

View 2 Replies View Related

LG Eve :: Home/Back Button Too Sensitive

Feb 3, 2010

If I go to use the camera or am not careful in other apps, my hand touches one of these keys and I am exited from the app I was using. Is there any kind of skin to put on top of this until that would make these buttons available when I actually need to press them? Or is there some setting in the menus to disable them, or configure them?

View 10 Replies View Related

HTC Hero :: Back Button Function - Home Screen

May 4, 2010

I have just got my hero back from RMA with a new screen. (the old one was fubar). But now the back button is bringing me the homescreen. And not the last screen. So if I browse my settings, and go 4 screens in. I want the back button to bring me to screen 3 (like it used to), and not to the home screen.

View 5 Replies View Related

Android :: Yellow Colored Background On Button Click / Override This?

May 7, 2010

Whenever a button is clicked the default behavior is that the button's background changes to yellow in color.

Is it possible to override this?

eg. in a game if the user clicks a "ok" button and if his answer/ choice is correct, then the ok button should change to "green" color just for fraction of a second (by default it is the yellow color on button click in android). And if the answer is wrong then it should be "red" in color.

View 2 Replies View Related

HTC Incredible :: Home/Menu/Back/Search Button Backlight

May 1, 2010

Does anyone have a problem with the backlight on the Home/Menu/Back/seach buttons. On my Incredible sometimes they come on when I bring it out of sleep and stay on. Other times they don't come on at all. Sometimes they just come on in the middle of doing something on the phone.

Have added some apps from the market but can't remember if it was like this from the start. Did a reboot and battery pull but it's still occuring.

I have also had a couple phantom reboots when in sleep mode so not sure if it's related.

View 12 Replies View Related

HTC Droid Eris : "Home" Button Locks Phone Instead Of Taking Back To Home Screen

Mar 29, 2010

I just installed lock 2.0 and i was just adjusting the settings and now every time I'm in my phone and i touch the "Home" button it locks my phone instead of taking me back to my home screen! Is this normal? Did I accidental do it in the settings? HELP its driving me crazy

I'm on the new 2.1 leak if that matters

View 7 Replies View Related

General :: Lock Button Isn't Working / Home Button Gives Power Screen (Samsung Vitality)

Jul 26, 2012

My phone was working just fine and randomly the lock button stopped working and the home button brings up the power screen!

View 1 Replies View Related

Motorola Droid X :: 2nd Click Of Home Button As Sleep Button?

Nov 2, 2010

I like being able to wake the phone to view the lock screen using the home button at the bottom of the phone, but is there any way to make it so that a second click of that button, or a click of one of the others down there, will make it sleep again? Having to press the power button up top is just an inconvenience.

View 5 Replies View Related

Motorola Droid :: Home Or Back Button Not Responding At Times - Freeze

Dec 7, 2009

Sometimes with the home or back button not responding at times? Kind of like a freeze where u have to press the buttons a couple of times then they will respond. Also, have you noticed that sometimes that pressing the power button will not wake the phone up? And when my phone call ends, it takes a while for the screen to come back from black so I can end the call. Should I get an exchange for my phone or are these issues supposed to be resolved with the update coming?

View 1 Replies View Related

HTC Magic :: Home Button & Call Button Not Working

Oct 20, 2009

this morning when I wake up I realized that:

- home button is not working
- call button is not working unless you're into the contacts application (doesn't work from home page)
- Astrid application has lost all of the TODO tasks.
- It doesn't asks for the unlock graphical code!

It lost all of its battery yesterday night while surfing on the browser. My phone is an HTC MAgic Vodafone, using Android 1.6 Any ideas on how should i proceed? I soft reset the phone already.

View 4 Replies View Related

General :: How To Override Default Functionality Of Hardware Power Button

Sep 22, 2011

If I write an app, is it possible to to override the default functionality of the hardware power button?

I only found this on google, but it didn't work: [URL]...

View 3 Replies View Related

Android :: Overriding Home Button For Car Home Replacement Application

May 19, 2010

I have been working on a replacement for the stock Car Home app for a bit, and I am completely stumped on how to override the Home button so that my app will be brought back to the foreground whenever the phone is docked. This is the way that Car Home works, so there must be a way. It seems that BroadcastReceivers won't work, because the intent that is broadcast whenever the Home button is pressed will still cause the default homescreen app to launch; I cannot prevent it. I can override the Home button from within my app, but that does me no good since this needs to work when the user is outside my app. Car Home also does not do anything weird like set itself as the default homescreen app while it's running (I checked the logcat to make sure).
I've been really beating my head against the wall on this. Does anyone have any ideas, or can you at least point me in the right direction?

View 3 Replies View Related

Android :: WebView.clearHistory() - Don't Want Back Button To Allow User To Go Back Further Than Current Session

Mar 31, 2009

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.

View 3 Replies View Related

Android : Back Button - Disable In Buffering Or Should Prevent The Player Tostart If Back Is Clicked

Oct 11, 2010

In my android application i have a video list screen,a buffering screen and a videoplayer screen.
As soon as the user clicks an item from videolist screen ,he is navigated to buffering screen and then to videoplayer.
In the buffering screen i am using Async task and doing the loading process in on background process.

Now my issue is like the user if has selested a video then gets navigated to buffering screen.But if the user clicks back when he is in buffering screen then initially he is getting navigated to videolist screen but immediately after that again he is navigated to videoplayer screen.

What i would like to have is either the back button should be made disable in buffering or should prevent the player tostart if back is clicked.

View 2 Replies View Related

Motorola Droid X : Back Button Functionality - Cannot Simply Go Back One Menu Using The Back Key

Jul 15, 2010

This is my first android device and i'm loving it... but one thing that irks me is the use, or lack thereof, of the back button.

As I am navigating menus and options in the Settings, I cannot simply go back one menu using the back key. For example, if I go to Settings->Battery Manager->Battery Profile Options and want to go back to the Settings screen, I cannot.

Pushing the back button does nothing and I can only go back to the Settings menu by going Home, then re-entering.

Another quirk regarding the back button is when reading emails. Using a regular email account such as Hotmail, I cannot simply read an email and go back to the inbox using the button.

It makes navigating the phone very tedious.

View 5 Replies View Related







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