David became the most famous man among the Israelites. However, he was not inveigled by this; he was not a prisoner of fame or leadership but a prisoner of Allah's love.
Therefore, after killing Goliath he went out into the desert in the company of nature, glorifying Almighty Allah and contemplating His favors.
Verily, We made the mountains to glorify Our Praises with him (David) in the Ashi (i.e. after the mid-day till sunset) and Ishraq (after the sunrise till mid-day). And (so did) the birds assembled: all with him (David) did turn (to Allah i.e. glorified His Praises). We made his kingdom strong and gave him wisdom and so und judgment in speech and decision. Surah 38: 18-20
Creatures such as the plants, birds, beasts, and even the mountains responded to his voice glorifying Allah. Allah had chosen David to be a prophet and revealed the Psalms to him. As He the Almighty said: ... and to David We gave the Psalms. Surah 17: 55