LM317 application notes show how.
Select as Best AnswerUndo Best Answer
So if i make one using LM317, won't i need a transformer(like one used in rechargeable torch lights with Lead-acid battery)?? Can it handle the current from mains? I mean to say won't the high voltage will damage the circuit??
Yes you will need a transformer and supply it with DC 7 to 10 volts should do. the LM317 controls the charging current - Lots of information on the LM 317 dta sheet.