David went through A LOT. I mean A LOT. He went through numerous trials before he ever became king. When He did become King- that doubled the trials and hardships. The one I focused on here was when he had to flee for his life to escape the king who wanted to kill him. He tried to escape to a different place just to lay low for a bit but the rejected him. The poor man was just trying to stay alive and he wasn't even welcome in a nearby city so he returned home. When he did- his home town had been burned to the ground by the enemy and they took the women and children. His beloved wives and children. Angry? Furious? Defeated as a man? Clueless of what do? You bet he was all of those. BUT despite all of this- the Bible says he strengthened himself in the Lord. Now many of us, would probably be saying a few choice words, yell and scream in a tantrum fit, maybe eat a bucket of ice cream and cry our eyes out but David KNEW in his heart (I'm sure his mind was saying other things) where He needed to turn- the Lord. He strengthened himself in the Lord. Once He did, He asked the Lord of what He should do next and the Lord promptly and clearly answered Him of how to justly deal with this. He found the enemy, took them out, rescued His wives and children and even got his stuff back!
If he hadn't turned to the Lord, what would have happened? Things would have been real ugly for him. When you read his story, you'll see that he made some stupid decisions- we all do. But his heart was in the right place. Our minds might be scattered somewhere they shouldn't be but God judges the heart and not our mind.