As David was preparing ot pass on the baton of leadership to his son, Solomon, he reminded the new king that the Lord is the One who "searches all hearts and understands every thought and plan." The Lord knows what is unseen, and He is aware of every hidden motive of the heart. The wise choice for this wise king would be to submit to the Lord in all things. After all, that's the legacy that David, his father, left for him. What's so impressive about David's legacy is not that he was a perfect king. As I've already mentioned here, David obviously had his own issues – particularly in the incident and aftermath of sleeping with Bathsheba. However, regardless of how great his sin was, David never abandoned the Lord, and he never led the people of Israel in the path of worshipping someone other than Yahweh. David's hidden motive and secret ambition was to make the Name of the Lord great, and he succeeded in doing so. That's why God selected him as the most well-known king of the people.
Do you have hidden motives and secret agendas? God knows what they are. You cannot hide from Him. He searches hearts, and He only blesses those plans that are meant ot exalt His Name.