I'm planning on selling my current Android (2.2) device and was wondering what is the best way to remove all of my data from the phone and memory card. Will a factory reset do it? What about formatting the card?
Erasing your phone internal memory
I have not tried it but using Android fastboot or an recovery ROM it should be possible to overwrite each partition on your device. Fastboot also supports an erase command - I assume that this erase can not be considered a secure erase.
Therefore a secure way would be to overwrite to the two partitions userdata and cache (and may be others depending on your device). The image used for overwriting should be as large as the partition.
Erasing the SD-Card
SD-cards can easily be "undelete" using a card reader and a common PC. Therefore it is strongly recommended to wipe it.
Best way would be to use an SD-Card reader on your PC and then use a tool like WipeDisk.
Make sure you back up any data you'll want from both the phone and the card beforehand.
A factory reset will clear all user modifications to the stock software (installed apps, files, etc), leaving a clean device. For the card, go to Settings - SD & Phone Storage (or some similar menu), and select "Unmount" and then "Format SD Card" or "Erase SD Card". This will erase all data from the card.
For the internal storage of the phone you can only do a "Factory reset", this will leave your phone with the default factory configuration with no apps installed or any configuration. It's not a "safe method" of deleting the content, but you can't have access to the physical internal storage so this is all you can do.
For the SD card, as @Robert said, the best option is to extract it from the phone and put on a Card reader in your PC and use some "safe erase" software. The one @Robert mentioned, WipeDisk, is free and reasonably good, so it’s a good option.