Trouble filled the life of David, but so did victory, especially when fighting the enemies of God and of Israel,
And there was war again; and David went out and fought with the Philistines, and struck them with a mighty blow, and they fled from him (1 Samuel 19:8).
Having a heart like the heart of God made David invincible. He only suffered lost when he strayed from the Lord, such as when his first child with Bathsheba died, because of David’s sin with Bathsheba.