After a strength training workout there is a short-term increase in testosterone (t).
However after only 30 minutes t levels return to baseline.
Vingren et al found that long-term strength training does not appear to change resting t levels.
De Souza et al showed that high mileage runners (ca. 110 km/week),
had significantly lower levels of t compared to moderate-mileage runners (approximately 54 km/week) and sedentary control groups of a similar age.
Lee et al explains how body fat (adipose tissue) contains the enzym aromatase that converts testosterone to estrogen.
The main mechanism by which exercise increases t seem to be indirectly by lowering bodyfat.
However a study performed in Finland showed that lowering the daily fat intake for non obese men reduced t levels.
Foster & Samman found that without careful nutritional planning, vegetarians may present low zinc status which has been shown to have a negative impact on t.
My conclusion is to avoid extreme endurance training.
Other forms of training such as strength training or moderate aerobic training will increase t levels indirectly by lowering bodyfat percentage.
A good diet also helps with this, however make sure to take in some fat.
Most of this is answer is ripped from this article, which also contains further references and details.