God called David a man after His Own heart. David had failed in his life but he always come back to God and made his wrongs right.
To have a heart after God:
1. We must have a respect for God appointed authority
2. We must love Gods Word
3. We acknowledge our own failure in our lives, repent and accept the consequences.
4. Seek the will of God