Among his tweets, Hammer said, apparently referring to the arresting officer, that he was asked whether he was on parole or probation before the man tried to pull him out of his vehicle Thursday night.
Police in Dublin, east of Oakland, said Hammer was in a vehicle with expired registration and he was not the registered owner.
"After asking Hammer who the registered owner was he became very argumentative and refused to answer the officer's questions," police spokesman Herb Walters wrote Saturday evening in an e-mail to CNN.
Hammer -- a rap and dance icon in the late 1980s and 1990s -- was arrested on suspicion of resisting an officer and obstructing an officer in the performance of his duties, according to police spokesman Herb Walters.
The incident occurred at the Hacienda Crossings shopping center.
Hammer began his tweets Saturday with "chubby elvis looking dude was tapping on my car window, I rolled down the window and he said 'Are you on parole or probation?'"
"While I was handing him my ID he reached in my car and tried to pull me out the car but forgot he was on a steady donut diet," Hammer continued. "It was comical to me until he pulled out his guns, blew his whistle and yelled for help (MallCop) !!! But make no mistake he's dangerous."
Hammer, 50, was booked and released on bail from Santa Rita Jail, Walters said. A court date is next month, and police have until that time to decide on any charges.
No drugs or alcohol were suspected in the incident, police said.
In another tweet, Hammer, born Stanley Kirk Burrell, said, "only thing more dangerous than a scared man with a gun, is a scared man with an agenda, a gun and a badge."
"I will now answer his question, contrary to his personal beliefs, all people of color are not on parole or probation fat boy!!!," wrote Hammer, later adding he thought of his arrest as "a teachable moment" and an "eye opener."
Hammer, who had a hit single in 1990 with "U Can't Touch This," has been enjoying a resurgence in his career and took the stage with "Gangnam Style" Korean performer Psy during the American Music Awards last November.
Hammer performed "Too Legit to Quit," which was released more than 20 years ago.
CNN's Michael Martinez contributed to this report.