Could be. But first check and clean all of the battery cables - especially the ground cable.
Another test is to use jumper cables to first check the solenoid. Attach the jumper cables directly to the battery posts (not the cable clamps). Hook the negative to a bolt on the engine. Touch the positive to the solenoid + (hot) connection to see if the starter turns over. If it does then the problem is the battery cables. If it does not then the solenoid is suspect.
While everything above is hooked up, touch the positive to the starter + (hot) connection. The starter should spin. If not then the starter is going. If it does then the solenoid is likely the problem. The solenoid "click" should be it engaging the starter gear but one can't be sure.
Hitting with the hammer may loosen any corrosion in the starter but the shock may cause a poor connection to be able to conduct enough electricity to allow the starter to function.
Anyway, try these tests and report back. Good luck.