We can also pray for the wrong reasons. James 4:2-3, "You do not have because you do not ask God. When you ask, you do not receive because you ask with the wrong motives." An X-ray machine can look at a person's heart, but it can't look at the motives in a person's heart. Only God is able to look into our hearts and see why we're asking for something. Prov. 16:2 says, "All the ways of a man are clean in his own sight but the Lord weighs the motives." If we're asking for something selfish or it will hurt us in some way, God in His mercy will deny our requests.
Jesus told us to examine our motives when we give our offerings, fast, and pray (See Matt. 6:1-6, 16-18). We are not to give grudgingly (against our will) or under compulsion (out of guilt if we don't) because God loves a cheerful giver (2 Cor. 9:7). The Lord is looking past the outward deed of giving to see why we are doing it. On the day of judgment, He will reveal the motives of everything we do (1 Cor. 4:5), so we need to do it right the first time.
What is your motive for the things you do? As you go about your business today, make sure your heart is right first, then follow through with the action.