You have to isolate the battary charging path from the main power path in order to charg the battery with out error
there are some cherger (from the current generation) who can do that internally for other chrger you have to use automatic switch like the LTC4412 from linear
Send Your Battery specifications
Max Battery Voltage
Max Charge Current
Max Charge Voltages
or Battery Model Number
Then i will suggest you what to do?
Hope this will be helpful!
Battery Charger Termination Issues With System Load Applied Across Battery While Charging
which can be access from TI's website.
i m using my homebuild charger for li ion.
it is constant current charger with lm317.
and an op amp for voltage sensing for autooff the charger when the cell charges upto 4.2v.