If it is the end of the day, a dog that is barking could just be vocalizing that it’s hungry, or asking for some needed exercise or a bathroom break. If you are sure you have given enough exercise and attention but still can’t stop the dog from barking. Continue to try to identify causes.
Barking is caused by either an external or internal stimulus. Attention-getting barking arises from internal distress. Barking intended to sound an alert arises from a passing person, other dog or vehicle as the case may be. Barking due to internal stimuli can be addressed by training.
Ignore an attention-getting barking dog until it settles, and then reward it after settling down. Or, hold the snout firmly, gently say "shhh", and then reward the right response.
If you corrected the dog already and now it’s barking at you, you must be a little astute to know for sure, but you could be dealing with a dog talking back in a dominance tug-of-war for authority. In such a case a little dominance training is necessary, which does not involve physical punishment.
Barking when you are present is easier since you can correct the barking with proper correction and then praise when the dog responds obediently. Dealing with the problem when you're present may also prevent nuisance barking from happening when you're away.
For the barking attention-seekers, ignore them entirely and wait out the barking episode. This requires patience. The important step is to reward them immediately upon stopping.
The quick draw
A mixture of water and citronella or vinegar solution (one part vinegar/citronella to eight parts water) loaded into a squirt water pistol has a strong chance of getting the “no bark” point across. However, you must be a quick draw at the moment or the point is lost. Aim for the chest, not the face.
The best news of all is if, after careful evaluation, there are indications that the problem is a dog talking back in a dominance tug-of-war for authority then training to control dominance is necessary, but it does not involve physical punishment.
Along with humane and proper training methods and behavior management products, the situation is solvable with citronella technology, an important development in canine behavior management solutions.
A Citronella Bark Collar is the Most Humane and Effective Nuisance Barking Solution.
A Citronella Bark Collar uses technology to deliver a harmless burst of citronella spray to interrupt your dog's barking. Its spray is triggered by barking, and can be an effective tool for distracting the dog from barking. The Citronella Bark Collar spray works with four of your dog's five senses; he hears it, sees it, feels it and smells it. Citronella is a unique scent, not offensive to humans, which most dogs don't normally encounter so unusual enough to distract the dog from whatever it's barking at. (If you wish to see what one is, here is the link.)
It is important to note that it is possible but not usual that some anti-bark collars can be triggered by dogs barking in very close proximity to the one wearing the collar, resulting in inappropriate correction. These collars are not appropriate in multi-dog homes, where one dog's bark can cause the non-offender to be corrected.
Physically correct
Do not be violent, inhumane, cause pain or frighten. When the dog is barking inappropriately, get down to its level, firmly wrap one or both of your hands around the snout (don't shake it), and repeat your corrective command of SHHhh, or a sharp no! Your dog can't bark with its mouth closed. Hold on until it stops making noise and stops resisting the placement of your hand by trying to wriggle away. This also asserts your dominant role in the process. Dogs are not children and they find security in a pack leader that leads and who they trust.
If the dog is on a lead and has been trained to respond to a quick corrective tug accompanied by a SHHhh, or sharp No, this is an easy, good method to end barking.
Never yell
Your dog is barking because it needs to tell you something, maybe that it needs a bit more attention. Yelling will upset and confuse your pet and cause it to bark even more. As always, give praise when the barking stops.
Your dog’s voice is beautiful.
It is unrealistic and unfair to not allow your dog to express itself and bark, nor should you always expect the dog to immediately silence itself when barking. If the dog needs to alert you to something and has been discouraged from speaking up, this can have dangerous consequences for you and the family. If the dog is barking to alert you to someone’s arrival, allow it to do its perceived job and thank the dog for its efforts. Unfortunately, there will come a day when you will miss that voice.
I have fleshed out all the parameters of the various scenarios I can think of, I hope it helps you come to your answer.