Heres some ways that you may be able to help or prevent a bladder infection from happening. Sex doesn't have to cause it heres a pointer for that.
After you have sex make sure you pee because this can give you a urinary tract infection as well.
Cut caffine out of your diet, when I say caffine I mean soda.
Drink plenty of water and try drinking a glass of cranberry juice a day if you dont' like cranberry juice there are over the counter pills that do the same thing as cranberry juice.
Try these things and if your bladder infections continue go back to the doctor.