One of the themes in David’s life was that David had a heart to build the temple.The background of the temple is interesting for a couple of reasons.
First, what precipitated God’s promise of a house to David (i.e., a dynasty) was David’s intense desire to build a house for the Lord (i.e., a permanent, physical structure; 2 Sam 7:1–17; cf. 7:3; 1 Kgs 8:17–18; 1 Chron 22:7; 28:2; Psalm 132:1–5; Acts 7:46).
Second, the location of the temple came about from the sinful census of David. David was tempted by Satan to command a census, perhaps to find confidence in its size instead of God (cf. 2 Sam 24:3), bringing about God’s wrath through pestilence at the hand of his destroying angel. David built an altar on the threshing floor of Ornan the Jebusite where he saw the angel of the Lord (2 Sam 24:1–25; cf. 1 Chron 21:1–30), and David proclaimed the house of the Lord would be built there (1 Chron 22:1).
1 Chronicles rushes through Israel’s history, primarily in genealogies in 1 Chron 1–10 and recounts David’s kingship in 1 Chron 11–20. The book then slows down to focus on David’s interest in the temple in 1 Chron 21–29. David instructed Solomon and Israel to build the temple and how to build it. Then David made Solomon king (1 Chron 22:2–23:1). David organized the Levites (1 Chron 23:2–32), priests (1 Chron 24:1–31), musicians (1 Chron 25:1–30), and gatekeepers (1 Chron 26:1–19).
From the above, we can see a couple of practical lessons.
First, David once said, “Delight yourself in the Lord, and he will give you the desires of your heart” (Psalm 37:4 ESV). As he knew from his involvement with the temple, however—planning it but not building it—sometimes the means whereby God has for us to live out the desires of our hearts is not always as we planned.
But, second, given David’s sin with the census and God’s having Solomon build the temple due to David’s bloodshed, God is nonetheless gracious to grant and fulfill our hearts’ desires in His own way in spite of our sins and circumstances.