Learning from David's experiences, God meets us in our heart rather than our mind therefore we need to focus on the "heart of the matter".
"David son of Jesse is a man after my own heart, for he will do everything I want him to do." Acts 13:22 & 1 Samuel 13:14 (NLT). There are many reasons why God proclaimed that David's heart is what He desire from us.
Many of us are like David. David is remembered as a man after Gods own heart, he was guilty of horrific sin which he committed adultery with Bathsheba, and then conspired to cover his sin with the murder of her husband.
One example is this (I learned the most): David who learned that "thinking" leads to sin. David with Bathsheba (2 Samuel 11). David woke up from a nap, went for a stroll on the roof of the palace. As he looked out over the city, he noticed a woman taking a bath. Through the eyes of David, enter into his mind, he sees a beautiful naked woman and began thinking about her. I am a man, and I have a GOOD IDEA

what he was thinking? David's thinking led him to self-serving which was motivated by lust and envy.

This is where God has a problem with me (as well as with many Christians). Reading Psalm 51:10
Create in me a pure heart, O God, and renew a steadfast spirit within me. David wrote this after prophet Nathan came to him after he had committed adultery with Bathsheba.
Learning from David, I have learned that God loves but He also hates. Psalm 97:10
"Ye who love the LORD, hate evil." Reading Psalms, David used six synonyms to describe Scripture: law, testimony, precepts, commandment, fear, and judgments. David understood that he was chosen by God. 2 Chronicles 6:6
But now I have chosen Jerusalem for my Name to be there, and I have chosen David to rule my people Israel. Why did God chose the Jewish people during the Old Testament time and not the Gentiles? Deuteronomy 7:6
For you are a people holy to the LORD your God. The LORD your God has chosen you out of all the peoples on the face of the earth to be his people. I have found that God chose unqualified people and what kind of "logic" is that? Here are the example of the GREAT faiths of "unqualified people": Lot got drunk and committed incest. Abraham doubted God and committed adultery. Jacob deceived his father. Moses murdered. Paul (Saul) murdered Christians. God will use ordinary good people as well as ordinary very sinful people to accomplish great things. God will use people who have the life experiences by that will Glorify Him by putting them through the right spiritual directions and teaching them the right spiritual lessons. God knows their hearts and He will honor their search for truth.
God sees and measures the heart more than He sees actions. Our sinful actions were the RESULT of our sinful heart.
I also have learned that David was an example of how we are to serve others without demanding our rights.(LOVE) Psalm 27:4 -- David said,
"One thing I have asked from the Lord, that I shall seek: that I may dwell in the house of the Lord all the days of my life, to behold the beauty of the Lord, and to meditate in His temple." David have cried more over things that have happened to other people that he care about than he have ever cried about things that have happened to him. When David is identified with God, the things that break his heart when some dishonor God.
To understand God's love, look at David's love through David's writings.