David Villa has thanked former Spain team-mate Xabi Alonso, who has announced he will retire from football at the end of the season.