you need to check whether it's stopped or not from within your service and you are half done on that line
if (stopped)
break;
now make stopped
a static boolean and set it to true on button click,
Edit
You are already checks Common.isDowloadProgress
but it's commented and I believe you need to break the loop as follows
while ((count = input.read(data)) != -1)
{
if (Common.downloadChkLogout)
{
if (Common.isDownloadProgress)
{
if (stopped)
{ break; }
total += count;
Bundle resultData = new Bundle();
resultData.putInt("progress",
(int) (total * 100 / lenghtOfFile));
bean.setProgress((int) (total * 100 / lenghtOfFile));
rec.send(UPDATE_PROGRESS, resultData);
output.write(data, 0, count);
}
else
{ break; }
}
}
success = true;