David was beloved of God, a man "after His own heart" and David was in constant communication with Him. David talked so easily to God, and not only in generalities but specifically. In the scripture below he first asked if he should go to Judah. God answers yes. Notice that wasn't the end of the conversation, David then asked for specifics, "Where should I go?" And God told him Hebron. So he went.
David inquired of the Lord. Then he listened to him and obeyed. So simple, yet I seem to get it backwards and try to obey without first listening to what I'm supposed to do!
2 Samuel 2:1-2
New International Version (NIV)
David Anointed King Over Judah
2 In the course of time, David inquired of the Lord. “Shall I go up to one of the towns of Judah?” he asked.The Lord said, “Go up.”
David asked, “Where shall I go?”
“To Hebron,” the Lord answered.
2 So David went up there......