The Ex

So me and my ex are great friends and he will txt me now and then and flirt a lot with my then be like he’s talking to a another girl so i don’t understand what this means ? Why doe he keep flirting ?