diff options
author | Andrew Dolgov <[email protected]> | 2012-10-19 11:35:36 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-10-19 11:35:36 +0400 |
commit | 92bd1028a0ae2ff44212a3521a6d7db70e5a7dea (patch) | |
tree | 1f1197a9958dfa78c4f2bb3bca4cb38ea8184ed2 | |
parent | 979cc27136872b21e1cb4b1fd16a1585ddfa5842 (diff) |
better error reporting when unable to open image
-rw-r--r-- | src/org/fox/ttcomics/ComicFragment.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/org/fox/ttcomics/ComicFragment.java b/src/org/fox/ttcomics/ComicFragment.java index 38097c8..7c7e557 100644 --- a/src/org/fox/ttcomics/ComicFragment.java +++ b/src/org/fox/ttcomics/ComicFragment.java @@ -56,9 +56,6 @@ public class ComicFragment extends Fragment { }
e.printStackTrace();
} catch (IOException e) {
- if (activity != null) {
- activity.toast(R.string.error_loading_image);
- }
e.printStackTrace();
}
@@ -93,8 +90,14 @@ public class ComicFragment extends Fragment { @Override
protected void onPostExecute(Bitmap result) {
- if (getActivity() != null && isAdded() && result != null) {
- image.setImageBitmap(result);
+ CommonActivity activity = (CommonActivity) getActivity();
+
+ if (activity != null && isAdded()) {
+ if (result != null) {
+ image.setImageBitmap(result);
+ } else {
+ activity.toast(R.string.error_loading_image);
+ }
}
}
};
|