I've found that turning black jeans inside out helps as well as using any detergent that's not Tide! LOL! Don't use anything with bleach in it and generally I've found generic brands aren't as harsh. Also, it's been my experience that line drying instead of using the dryer helps.
Jo