In Peter’s first sermon, he quotes something David had said, “You have shown me the way of life, and you will fill me with the joy of your presence,” (Acts 2:28). David knew the way of the Lord. He followed God, and even when He failed, God still loved Him and knew His heart. He still called David a man after His own heart. David knew the way of the Lord, lived His life as a testimony to who God was, and loved Him with all of His heart.
David knew the joy of the Lord because of all He had done for Him. He walked in His goodness and mercy and because of all He experienced with God, He knew His joy. The joy of the Lord was His strength.
This is perhaps why Peter included this part of David’s testimony in his message. He wanted the new followers of Jesus to know that when you know the way of the Lord, He gives you joy and that joy sustains you and gives you strength.