My Nikon D3100 has stopped focusing before taking a picture?
How can I fix that?
Added (1). I mean the autofocus on the camera has stopped working. I only recently got this, its brand new, so I'm a little concerned.
Have you read your manual for your camera AND the manual (or little pamphlet) that came with your lens?
The likeliest thing that happened was that you accidentally toggled the M/A switch on the side of the lens
Barring that call Nikon.
Set camera dial to A, AF on, AF single point center, ISO 100, and EV 0. Step outside under the sun and take a shot of a brightly colored parked car. Take another shot of another car at another distance. If both pictures don't come out correctly, bring the camera back to the store at once. Don't forget the box and everything that came in it. Don't forget the receipt too.
From a Canon standpoint, if the lens is set to Autofocus (AF) and you're using the Viewfinder, it should autofocus. But even if it's left at AF and this time you're using the Live View, if won't autofocus if you use the shutter button. Instead there's another button for it.
So give that a try. Try both Viewfinder and Live View and see when does the AF work/not work, and be sure the lens is set to AF.
Also, never try to manually focus the lens while it's in AF unless the lens is capable of doing that. Lower-end lenses like the kit-lenses that come with the camera usually don't allow it. So be careful.