Using common sense when walking/hiking in predator habitat goes a long way. I hike in cougar/timber wolf/black bear/grizzly bear habitat on an almost daily basis for my job. Chances are, unless you are deliberately stalking a wild animal, it will know you are there long before you know it's there, if you ever even see it, especially cougars and wolves (but generally the average person has very little to fear from them under normal circumstances.) Bears can be stumbled upon occasionally, in a situation where both parties are surprised, but this is where common sense should prevail. They are generally either timid or at worst indifferent to your presence. They are normally only aggressive under a handful of scenarios: they feel you are threatening to steal their meal, they feel you are threatening to harm their cubs, or they feel you are threatening to harm them. I have had numerous bear encounters (excluding the practically domesticated ones at the local dump) and in all but one of them, the bears have been of the timid variety and took off running immediately upon spotting me (or my trusty hound bearing down on them.) One encounter involved an 'indifferent' bear. He wasn't aggressive at all, but no amount of shouting, arm waving or rock throwing would dissuade him from going about his business in a very nonchalant, leisurely manner. In fact, he almost seemed mildly amused at the crazy shirtless human carrying on and making a fuss. After a few minutes, he trundled on his way and didn't return.
Also, sometimes even when they seem aggressive, they are just 'bluffing.' They may go so far as to charge, but will stop short, stomping the ground, swiping their paws and chuffing and snapping their jaws. I have a friend who recently had a run-in with an aggressive bear that did exactly that. He had wrecked his truck 30 km from his camp and was walking back. He could hear a bear in the bush stalking him for some time before it ran out and charged him. He didn't have a firearm with him so he picked up a big rock, stood his ground and luckily the bear stopped about 10 feet from him and put on the aforementioned aggressive display before my friend threw the rock at it and it turned tail and ran. Now, I'm not suggesting that I would let an encounter get that far if I had a firearm, but it just goes to show that, just seeing a predator or any other potentially dangerous wild animal is certainly in no way an excuse to fire at it. You should be reasonably certain that it intends to do you harm. I carry a firearm with me on hikes, but I hope that I never have to use it to kill a wild animal in self defence.