What should I do if I can't stop thinking about my ex?  

Start new hobby like painting, hiking, or learning a musical instrument

Try meditations

Start traveling, or just change the environment

Reduce your social media presence

Set new  personal goals

Seek professional assistance