During the time David was fleeing from Saul (the king who wanted him dead), the close relationship David had with his LORD is so evident. In the midst of this difficult time, David penned Psalm 56 and Psalm 34.
The words found in Psalm 34:1-3 give us a glimpse into the kind of fellowship David had with God. "I will extol the LORD at all times; His praise will always be on my lips. My soul will boast in the LORD; let the afflicted hear and rejoice. Glorify the LORD with me; let us exalt His Name together."
David's life changed. Saul died and David became king just as God had promised him. In his powerful position, he could have most anything he wanted. Everyone was at his beck and call. He possibly became somewhat self-sufficient and did not depend on God as he once had.
Then - the time came when David began shirking his duty. He became idle - possibly bored ("In the spring, at the time when kings go off to war, David sent Joab out with the king's men and the whole Israelite army. They destroyed the Ammonites and besieged Rabbah. But David remained in Jerusalem." 2 Samuel 11:1)
David was not where he was supposed to be as the king of the Israelites and he fell from the close, intimate relationship he had experienced with God. His fall included adultery. Our fall may be something completely different. But, idleness, being too comfortable, having more than we need can cause us to become self-sufficient rather than depending on our All-Sufficient God.
Be careful. If it can happen to David, it can happen to you and me.