A 20-year-old man has been accused of attempting to kill his ex-girlfriend and her new boyfriend as they were taking a walk in Riviera Beach.