It can be due to any meniscal injury specially of you feel like your knee get locked while bending. Or it can be due to chondromalascia patella if there is any pain behind your knee cap.. It can be completely diagnosed only by an MRI. But you can consult a physiotherapist for proper assessment, diagnosis and treatment.
Next Steps
Go to a physiotherapist.. Ultrasonic therapy +IFT +Heating therapy +some strengthening exercises will be helpful for sure.
Health Tips
At home.. Rest +hot water fomentation +pain killer gel +no long standing /walking /stair climbing +no cold exposure +use knee supports/cap(elasticated) +no squatting /cross leg sitting.