This is all of us who believe, have to do, when we sink in the various trials and difficulties of life. Like king David did, rely on his God, all the time, even in the worst situations, when he had oppression and enemies from all directions. His heart failed which means he felt afraid, discouraged, depressed, but, he still trusted in his God and did not give up hope!
We have hope, because we have the God of hope, as the Bible calls him. There is always hope with God. He never leaves us without exits from temptations, but provides always a way out.
He holds our hand, until we pass through the storm.
The hopeless situations become hopeful with the God of hope.
Notice in verse 26, David said that God is the strength of his heart! Not the mind! That is because we feel any emotions with the heart, and our heart gets hurt, therefore, God brings a consolation and comfort to our heart!
The closer we come to God, the more he becomes the God of hope for us.