assalam 'alaikum warahmatullahi wabarakatuh
I do not want to mention how many Surahs i know, whether I pray Qiyam al-Layl every night or not, whether I fast every Monday and Thursday or not, whether I donate and help my brothers and sisters often or not. These things make me really uncomfortable if I tell people unless in very rare situations like when a person asks me privately. Mostly my family do ask such questions and I answer. However, in puplic, a BIG NO.
No offense my dear brother Ahmed. I just wanted to tell my thinking and situation. Rasoolullah (sallallahu 'alaihi wasallam) said, Innamal A'maalu Binniyyaat. ('Amal is based upon intention).
So when I say I have done so and so, my intention might be to encourage others to do so and so what I did because that is good. So that is a good intention. However, if my intention is to show others how good I am, that is al-Riya.
Therefore the best way I can think of is to prevent saying such things in public, and try not to tell in private also, unless we are asked.
Once again forgive me my respected brother if my words seems offensive to you. It is not my intention. I just have talked in general.
wassalam 'alaikum warahmatullahi wabarakatuh