diff options
author | daneren2005 <daneren2005@gmail.com> | 2013-11-26 10:55:29 -0800 |
---|---|---|
committer | daneren2005 <daneren2005@gmail.com> | 2013-11-26 10:55:29 -0800 |
commit | 9baef2e05c86f0c9e8d4d5ce0d735f0c8cf90d33 (patch) | |
tree | 8ad3485a4262b19ecd841b53b3e2e408c62b86e4 | |
parent | 800a606263dc29dddd7568bfba651d53b38f9866 (diff) | |
download | dsub-9baef2e05c86f0c9e8d4d5ce0d735f0c8cf90d33.tar.gz dsub-9baef2e05c86f0c9e8d4d5ce0d735f0c8cf90d33.tar.bz2 dsub-9baef2e05c86f0c9e8d4d5ce0d735f0c8cf90d33.zip |
Fixed ANR
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java b/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java index dc892634..e0cdf543 100644 --- a/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectBookmarkFragment.java @@ -177,14 +177,23 @@ public class SelectBookmarkFragment extends SubsonicFragment implements AdapterV @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { - DownloadService downloadService = getDownloadService(); + final DownloadService downloadService = getDownloadService(); if(downloadService == null) { return; } - Bookmark bookmark = (Bookmark) parent.getItemAtPosition(position); - downloadService.download(bookmark); - Util.startActivityWithoutTransition(context, DownloadActivity.class); + final Bookmark bookmark = (Bookmark) parent.getItemAtPosition(position); + new SilentBackgroundTask<Void>(context) { + @Override + protected Void doInBackground() throws Throwable { + downloadService.download(bookmark); + } + + @Override + protected void done(Void result) { + Util.startActivityWithoutTransition(context, DownloadActivity.class); + } + }.execute(); } private void displayBookmarkInfo(final Bookmark bookmark) { |