When the hardware buttons on your smartphone aren't working right, it can be a real pain to do almost anything. Simple tasks like accessing your home screen, opening the menu, and powering your phone on and off—normal functions you use every day—become chores, if you're even able to do them at all.
Luckily, if your warranty's expired and you don't want to pay to fix it or buy a new phone, there's an app that lets you add the buttons to your home screen. It's (appropriately) called Button Savior, and it's free to download on Google Play.
Before you get started, though, you should know that this app is better to download as a precaution or if only some of your buttons are broken. If none of them are working at all, you'll have to have ADB installed on your computer so you can use it to install the app on your phone. According to the developer, the power, home, camera, call, and volume keys will work for everyone, but you need a rooted device for the rest. Having said that, here's how it works.
Button Savior adds three sets of buttons to your touchscreen. What's in each set varies depending on your device, but main functions like Home, Back and Power are always the same. One of the cooler features is that even if you have an older device that doesn't have certain buttons, it adds them for you (like search and camera). If you want to remap or disable any of the buttons, you'll have to upgrade to the pro version ($2.01).
Again, if your buttons are totally busted, you may have difficulty even downloading and installing the app. If you have this problem, you can install it by installing the Android SDK and using ADB to control your phone. You can find a guide on how to do this here.
Another issue is that the one thing that Button Savior can't do is wake up your phone when it's asleep. You can use ADB to reboot your phone with the adb reboot command, but that would be a pain to do every time. As an alternative, you could try the SmartScreen app, which wakes your phone when you pick it up. Just make sure you have a password on your lockscreen if you decide to use it.
Obviously, this isn't exactly a quick fix. If none of your buttons work, it's definitely not the best permanent solution, but if you can't afford to fix your phone right now (or just need to use it while you're waiting to get a new one), it'll get you by in the meantime.
Have the same problem with your iPhone's Home button? You can try force quitting apps, which will sometimes fix it. If that doesn't work, you can work around it by enabling Assistive Touch under Accessibility.
But you'll always have to have the menu on the screen. In order to hide the Assistive Touch menu, you'll have to press the Home Button three times, which defeats the purpose if you're trying not to use it.