(1) A simple method
BEST method is to use a proper charger - they are not high cost if you look around and doing it properly extends precious battery life.
Next best in this context is my "better" method in 2. below.
BUT, given the system you say you are using now, the following very simple method will greatly improve your result and ave your battery from an early death.
You need a 1 Ohm resistor and a voltmeter that you can trust to read a 4.1V votage accurately. Without these the simple method risks battery damage or destruction - just as your present method does.
Warning: Straight connection to a USB port is very unwise but may be viable if the port current-limits.
If the current is ever higher than the rated maximum then battery destruction may occur.
If the battery voltage ever exceeds 4.2V at room temperature battery damage WILL occur and battery destruction may occur.
Worst case a badly treated battery can turn into a flaming inferno in seconds.
A usably OK result can be gained by:
(1) Calculate Imax = same mA as battery mAh capacity.
LOWER is OK. Higher is not.
eg 1200 mAh battery = 1200 mA max and say 1000 or 500 or lower mA is OK.
(2) Connect a ONE OHM resistor in USB to battery line.
(3) Connect discharged LiPo battery to USB port via 1 Ohm.
(4) Measure voltage across the resistor. The voltage will be 0.001 Volt for every mA that flows. eg
1000 mA gives 1.000 Volt
789 mA gives 0.789 V.
1234 mA gives 1.234 V. etc.
If the measured mA is LESS THAN Imax in (1) above then this is OK to charge with.
(5) Use Arduino analogRead() function WHILE CHARGING to measure battery voltage.
BE SURE that the voltage that you read with the Arduino matches what a quality meter says.
When Vbattery (measured from Bat + to Bat- AT the battery) measures 4.1 V STOP CHARGING, remove voltage.
Battery will be perhaps 70% charged and will have a long cycle life (if not already damaged).
For 10 bit ADC = 1024 counts total (0-1023) then
for 5V reference 4.1V count = 4.1/5 x 1023
= 838 counts.
Using 830 counts to start with is safer.
When battery is at the upper charge limit, and before removing Vcharge, measure voltage at battery with calibrated quality meter. Result should be 4.1V using above system.
Even with a quality calibrated meter NEVER exceed 4.2V - and 4.1V is better.
The BEST method is to use a proper charger - they are not high cost if you look around and they extend precious battery life.
(2) A better method:
LiIon (Lithium Ion)and LiPo (Lithium Polymer) batteries are functionally the same for charging purposes. I'll use the term "LiPO" from here on. I'll assume single cell batteries as most in cellphones and similar are. If the terminal voltage is between about 2.5V (should really be higher) and 4.3V they are single cell,
LiPo batteries have 4 main charge areas.
Under about 2V = dangerously dead. Discard
2V to about 3V = under voltage - charge very slowly
3V to 4.2V = charge at CC = Constant Current.
On reaching 4.2V charge at CV = Constant Voltage until current reduces "automatically" (under battery chemistry control) to about 1/4 x max rate.
Max charge rate is set by the manufacturer but is almost always the numerical mAh rating in mA. eg for a 1000 mAh battery max rate is 1000 mA. For a 3300 mAh battery it's 3300 mA etc. In a very few cases it is lower - maybe =half standard values and for a very small number of cells its higher - assume you do not have those.
Max voltage MUST NOT exceed 4.2V at room temperature. Lower, say 4.1V, does no harm and increases battery cycle life while slightly reducing capacity per charge.
The battery mAh rating is known as "C".
If C = 1200 then a cahrage rate of 1200 mA = C/1,
a charge rate of 300 mA = C/4,
a charge rate of 12 mA = C/100 etc
An easy charging method that gives long cycle life and about 70% to 80% of max possible capacity and a fast charge is
Determine max charge rate = C = Imax = same mA as battery has mAh capacity.
If Vbattery is < 3V, charge at C/20 or less until Vbattery reaches 3V.
If Vbattery never reaches 3V it is dead.
When V_battery = >= 3V, charge at C/1 until Vbattery = 4.2V ( or 4.1V)
Remove applied voltage. DO NOT EVER leave 4.2V applied to a charged battery.
A more usual method that is only slightly harder is.
Monitor charge current.
Charge as above until Vbat = 4.2V.
While holding Vbat at 4.2V monitor charge current. This will fall as the battery absorbs additional charge.
When Icharge falls to C/2 or C/4, stop charge. C/4 adds slightly more charge than C/2 but shortens cycle life.
Again - DO NOT leave 4.2V applied to battery once charged. Doing so will destroy the battery rapidly. Remove all voltage once charged.
Charging Lithium Ion & LiPo
Q: This is a 3.7v battery by giving 4.2v will it destroy it or are you referring 4.2v to explain the concept.
Read the above material and the battery university pages.
4.1 V ABSOLUTE MAXIMUM is what I recommended.
Most LiPo single cell batteries are labelled as 3.6 V or 3.7 V as that is approximately the average voltage across the discharge cycle.
When fully charged they are at about 4.2 V (or 4.1 V if you take my advice - which you should :-).
As they discharge the voltage falls and by the time they get to just above 3 V they are essentially fully discharged. They should never be discharged below 3 V as it damages them and there is only a tiny amount of energy left.
So 4.1 V ABSOLUTE MAXIMUM is good
MEASURED WHILE CHARGING and
AT the battery terminals or very close to them.
ie no long leads or resistors or connectors.
If using an Arduino to measure battery voltage, connect an Arduino ground lead to battery negative with as short a wire as practical and the ADC +ve input to the battery +ve at the battery connection point.
So once more: A LiPo battery labelled as 3.6V or 3.7V can and should be charged to 4.1V maximum and never discharged to below 3V.