Popped into my mind/head 突然想起

 It popped into my mind while I was watching TV.