I would think that this depends, to a large extent, on what is going on with your hips and knees. Generally, weight bearing activities such as walking or running are touted as being better for maintaining bone density. However, that same weight load can do some real damage to joints. If it were me I'd want to know more about what was going on with the hips and knees. In my own life I do winter training in my home gym which includes riding on the stationary trainer, walking (not running) on the treadmill, and resistance training. I have arthritis in both hips and am looking at hip replacements down the line. The cycling seems to bother the hips less than the walking. If you're getting hip pain while riding, I'd check seat height. A seat too high can cause reaching and rocking with can make the hips hurt big time.