Prevent complete charging? I'm looking for a way to prevent my phone from completely charging every time it is connected to my computer. I want to reduce the battery's capacity loss, as it is non-replaceable, and it seems to me that keeping the maximum charge at around 50% to 60% would be ideal. This chart, from this site, suggests that the benefit would be significant. 

Capacity at    Discharge
full charge    cycles

100%           300 – 500
90%            600 – 1,000
70%            1,200 – 2,000
50%            2,400 – 4,000
The only potential solution would be to find a way to current-limit the cable so that the phone would have to run off battery. You cannot simply disconnect Vcc and Ground pins, as the USB standard requires the presence of those electrical connections before D+ and D- pins are permitted to be energized. Running off battery like that would just increase your charge cycles, causing the wear you want to avoid.

As far as apps, there is no way to programmatically control the battery charging subsystem in this way; BatteryManager outputs information but does not accept inputs from user apps.