From 7648260a62d422c3b1d497cf8611b0e6ebef8c1a Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Mon, 25 Mar 2013 19:40:57 -0700 Subject: Cancel HTTP request in separate thread to not throw error --- .../github/daneren2005/dsub/service/RESTMusicService.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'subsonic-android/src/github') 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(); } }); } -- cgit v1.2.3