1 Chronicles 17:25
For thou, O my God, hast told thy servant that thou wilt build him an house: therefore thy servant hath found in his heart to pray before thee. For thou, O my God, hast told thy servant that thou wilt build him an house: therefore thy servant hath found in his heart to pray before thee.
David first formed the purpose of erecting a house worthy of the divine majesty and disclosed that intention to the prophet Nathan. His good intentions were accepted, yet the honor of actually building that house was withheld from him. He supplied the materials for it before his death, while the structure itself was raised afterward by his son Solomon. God had told him that He would build a house for him and establish it. That promise therefore gave him confidence in his heart and moved him to come and pray before God.