If you're a sport player or if you put lots of stress on your knees for whatever reason, my biggest advice is to stretch your legs before you do whatever it is that you do. The tendinitis is probably caused by a sudden increase in pressure on your joints.
If you like to work out, know your limit on your legs. Do leg-presses, side-step ups, mini-squats. Start small, work on strengthening the knee.
In the meantime, keep icing and take some ibuprofen for the inflammation and swelling.