My iPhone 4 camera sometimes works?

My iphone 4 got water into it but I kept it in rice overnight and it worked fine. The only thing that didn't work was the camera and flashlight. It's been like this for about 2 months. Two days ago I opened snapchat and my camera started to work as well as the flashlight. Yesterday I was face timing and the camera wouldn't work but the flashlight still does. What's going on? Could I get my camera back?

Water damage. If your contract is up, then I would trade it in and upgrade to a newer version as they take trade-ins even if damaged, so at least you get something back for it. Its actually cheap to upgrade that way and you get a new one on a new contract. Thats better then putting money into fixing an older (or broken) version.