*Does not work on version 4.1 or later, Ty SoundAbout app instead*
This is an open source project originally intended for use with the now legacy Android 1.6 (donut) release and 3.5mm headphone jack HTC multi adapters on the G1 due to android issue 2534. It was originally based on an abandoned project at code.google.com called toggleheadset.
Since initial release, lots of people have downloaded and used this application to fix hardware problems with their phones - specifically cases where the headphones connector detection doesn't work and your audio doesn't automatically switch to the correct output automatically. This has been a surprisingly common occurrence.
To install you need to place on your homescreen to use it by holding your finger down on the homescreen, selecting widgets and selecting togglheadset2. See http://code.google.com/p/toggleheadset2/wiki/InstallAndUse
Thanks to Adam King for changes to support 2.1+