Sure, that's how it works.
But keep in mind this: they have a certain lifetime, calculated in cycles (this is, the# of times it can be charged & discharged, & depending on your brand -hipro, lite on, etc... - it's going to be X hundreds of times).
The best approach then, we may say, is to discharge it completly before charging it again. As Pyree said, this way u don't discharge it/overcharge it or, as I've heard some say, it'll become "lazy"... just like cell phones'.
When home, use the AC adapter -or charger, brick...-,
when mobile, use the battery. Once it's fully charged, remove either or.