The remnant of the exiles were granted permission to Jerusalem by King Darius. They rebuilt the city walls under Nehemiah's leadership and then laid the foundation for the temple, but then got distracted from that work. Through Haggai God challenged the people saying this half-built temple represented their faith, half-built and half-focused. God challenged them, in Haggai 1:5, to 'give careful thought to your ways', and to rebuild the temple and rebuild their faith. In Haggai 2 we get the prophets second message, which can be broken down into three sections:
1) Backward Look (v1-3) - the people were grumbling and saying this temple was nothing like the one that Solomon had built that had been destroyed 75 years earlier. God said, stop looking back, stop grumbling, it spreads discontentment
2) Upward Look (4-5) - Haggai challenges the people instead to look up, 'be strong' in their faith, trust in God's promises, and 'work' [meaning here 'come back to God', 'work with Him', 'be his people again'] remember God does not abandon his people.
3) Look Forward (v6-9) - God promise that this temple 'will be' [in the future] greater, and that God will shake the foundations of the world. He gives no timescale for this and of course we know this temple reaches fulfilment in Christ (John 2:21). Indeed it is still being fulfilled as we are the temple as God, through His spirit, lives in us.
Let us not look backward and moan, let's look up and trust God, and look forward to the ultimate fulfillment of the future glory for us all in heaven.