In order to determine the nature of the injury you have sustained, you need to be examined by a physician, and you may require an MRI. The treatment, whether conservative (rest, physiotherapy, oral anti inflammatory drugs) or more invasive will be decided accordingly.
Because most cases of tendonitis are caused by overuse, the best treatment is prevention. It is important to avoid or modify the activities that cause the problem. When doing exercise, start slowly initially and gradually build up the strength of your activity level, while making sure to limit the number repetitions you do and the amount of force you use, and stop if you feel any unusual pain. Be careful to avoid or correct underlying conditions such as improper posture or poor technique in sports or work.