Keep busy, stay off their social media sites and put down your phone. The less energy you give to thinking about your Ex the faster you will be able to let go of the heartbreak you are feeling. Every hour that your mind is occupied with other things it will bring you closer to removing those pestering thoughts of your Ex-partner. In time you will begin to think about them less and less each day.
Quite often we hang on to the wrong partners because we are afraid to be alone. If you continue to settle in the wrong relationship you will be shortchanging yourself from the powerful love you are meant to have.