1 Samuel 17:37 The Lord who rescued me from the claws of the lion and the bear will rescue me from this Philistine!
David, who as a Shepard and had fought lions and bears, knew that it was not him who defeated the wild animals. David also knew that it would not be him who defeated the giant, Goliath. It was God with him who won the battles, and it was God who got credit for the victory.
What we can learn from this is to see God in all our victories and blessings in our everyday lives. To know that God is our success, our strength, our provider, the One who looks over us and loves us. We can learn to give God the credit, to be aware of God in our lives. When we do this our confidence will grow, not in ourselves but in the One who provides for us and we will get better and better at relying on God. Then the more we rely on God the more He can entrust us with and the better our lives will become. Sure there will still be hardship and suffering along the way, even David, King David suffered hardships, but even those will be eaiser to bare with God as our strength.
David got his strength of heart from knowing God, from recognizing and remembering that God had been with Him. We can gather that same strength by being aware of God's presence in our lives, thanking Him and putting those many moments in our rememberence. When we do that we can draw courage to face life because we know that God is with us.