Tips for Resisting the Temptation to Show Off
Question

There is an important issue which I want to know about; what happens is that whenever I do something good, I look for people to appreciate it, in other words to show off, I know it is not allowed in Islam to show off, but how can we get rid of this feeling? I try to but eventually I get into it.
Praise be to Allah.The one who wants to stop himself showing off has to do the following things to rid himself of this problem:

He should remember that Allah is always watching His slave.

This is the status of Ihsan (perfection in worship) which Jibril (peace be upon him) mentioned to the Prophet (peace and blessings of Allah be upon him), which is that you should worship Allah as if you can see Him, and even though you cannot see Him, He can see you. (Narrated by Muslim, 97)
When a person feels that Allah is always watching him, what other people think will become insignificant, and this will make him respect and fear only Allah.

Seeking the help of Allah to rid himself of the habit of showing off.

Allah says that the believers should say (interpretation of the meaning):
{You (Alone) we worship, and You (Alone) we ask for help (for each and everything).} [Al-Fatihah 1:5]
One of the things that will be of benefit in this matter is seeking the help of Allah and calling upon Him. The Prophet (peace and blessings of Allah be upon him) said: O people, beware of this Shirk (form of polytheism), for it is more subtle than the footsteps of an ant. The one whom Allah willed should speak said to him, How can we beware of it when it is more subtle than the footsteps of an ant, O Messenger of Allah? He said, Say, Allahumma inna na`udhu bika min an nushrika bika shayan na`lamuhu wa nastaghfiruka lima la na`lam (O Allah, we seek refuge with You from knowingly associating anything with You, and we seek Your forgiveness for that which we do unknowingly). (Narrated by Ahmad, 4/403; classed as authentic by Shaykh Al-Albani in Sahih Al-Jami`, 3731)

Knowing the effects of showing off and how it will be judged in the Hereafter.

Not knowing this leads to one falling into this sin or persisting in it. One should realize that showing off destroys all one’s actions (i.e., cancels out the reward), and that it brings the wrath of Allah. The wise person does not waste his energy in doing things that do not bring any reward, let alone deeds that bring the wrath and anger of Allah.
One of the greatest Hadith (prophetic narrations) concerning the punishment in the Hereafter of those who show off is the following, in which the Prophet (peace and blessings of Allah be upon him) said:
When the Day of Resurrection comes, Allah, may He be Blessed and Exalted, will come down to judge between His slaves, and every nation will be kneeling.
The first ones to be called forth will be a man who learned the Quran by heart, a man who fought for the sake of Allah, and a man who had a lot of wealth. Allah will say to the Quran-reader, Did I not teach you that which I revealed to My Messenger? He will say, Yes, O Lord. He will say, What did you do with that which I taught you? He will say, I used to read it night and day. Allah will say to him, You have lied, and the angels will say to him, You have lied. Allah will say, Rather you wanted it to be said that So and so is a reader of Quran, and that is what was said.
Then the wealthy man will be brought forth, and Allah will say to him, Did I not give you ample provision so that I did not leave you in need of anybody? He will say, Yes, O Lord. He will say, What did you do with that which I gave you? He will say, I used to uphold the ties of kinship and give in charity. Allah will say to him, You have lied, and the angels will say to him, You have lied. Allah will say, Rather you wanted it to be said that So and so is generous, and that is what was said.
Then the one who was killed for the sake of Allah (apparently) will be brought forth and Allah will say to him, Why were you killed? He will say, I was commanded to fight in Jihad (battle) for Your sake, so I fought until I was killed. Allah will say to him, You have lied, and the angels will say to him, You have lied. Allah will say, You wanted it to be said that So and so was courageous, and that is what was said.
Then the Messenger of Allah (peace and blessings of Allah be upon him) struck my knee and said, O Abu Hurayrah, these three are the first of the creation of Allah who will be dragged into the Fire on the Day of Resurrection. (Narrated and classed as sound by At-Tirmidhi, 2382; classed as authentic by Ibn Hibban, 408, and Ibn Khuzaymah, 2482)

Thinking about the punishment in this world for showing off

Just as there will be a punishment in the Hereafter for showing off, so too there is a punishment for it in this world, which is that Allah will expose him and make his bad intentions known to others. This is one of the interpretations of the Hadith of the Prophet (peace and blessings of Allah be upon him):
Whoever shows off, Allah will expose him. (Narrated by Al-Bukhari, 6134; Muslim; 2986)
Ibn Hajar (may Allah have mercy on him) said: Al-Khattabi said, this means: whoever does something that is not sincerely for the sake of Allah, merely wanting people to see him and hear him, will be punished for that Allah will expose him and make known what he is concealing.
It was said that whoever does something with the intention of gaining status and prestige among people, and does not seek the Face of Allah by doing it, Allah will make him the subject of bad speech among the people in whose eyes he wanted to gain status, and he will have no reward for it in the Hereafter. (End quote from Fat-h Al-Bari, 11/336)

Concealing worship and not making a display of it

The further away a person gets from places where his worship can be seen, the safer he is from showing off. Whoever looks for places where people gather, the devil makes him keen to show off his worship so that they will praise him for it.
The acts of worship which should be hidden are those which are not obligatory or those in which it is not the Sunnah to do them openly, such as Qiyam Al-Layl (night prayer), and giving charity, and the like. This does not apply to calling the Adhan (call to prayer), praying in congregation and other things which cannot and should not according to Shari`ah (Islamic law) be hidden.
We ask Allah to make our words and deeds sincere, and to forgive us for what we commit of showing off. May Allah bless our Prophet Muhammad.
And Allah knows best.