diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-03-25 19:40:57 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-03-25 19:40:57 -0700 |
commit | 7648260a62d422c3b1d497cf8611b0e6ebef8c1a (patch) | |
tree | 7d873da80b1b64410c73a38723136f866c723858 /subsonic-android/src | |
parent | 3519b29d8406d796b4d5318c62d6bf6f34d86c40 (diff) | |
download | dsub-7648260a62d422c3b1d497cf8611b0e6ebef8c1a.tar.gz dsub-7648260a62d422c3b1d497cf8611b0e6ebef8c1a.tar.bz2 dsub-7648260a62d422c3b1d497cf8611b0e6ebef8c1a.zip |
Cancel HTTP request in separate thread to not throw error
Diffstat (limited to 'subsonic-android/src')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java index e1f694e6..24dcbabd 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/RESTMusicService.java @@ -812,8 +812,16 @@ public class RESTMusicService implements MusicService { task.setOnCancelListener(new CancellableTask.OnCancelListener() { @Override public void onCancel() { - cancelled.set(true); - request.abort(); + new Thread(new Runnable() { + public void run() { + try { + cancelled.set(true); + request.abort(); + } catch(Exception e) { + Log.e(TAG, "Failed to stop http task"); + } + } + }).start(); } }); } |