Carry a spare trube whebn riding. Got a flat? Check inside of tire with fingers for pointed objects (glass, thorn, tiny piece of metal from steel belted radials, etc) and put in new tube and proceed.
At home patch tube and double check if patch is holding.
Proper technique for patching is essential. Find leak/puncture in tube; scuff area with that little piece of sandpaper; apply the glue; put match/lighter to glue and then immediately put on the patch.