Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. @Override
  2. protected Void doInBackground(String... params) {
  3. Bitmap output = null;
  4. try {
  5. URL url = new URL(params[0]);
  6. Log.d(TAG, "_log: output URL is: "+url.toString());
  7.  
  8. HttpURLConnection connection = (HttpURLConnection)url.openConnection();
  9. connection.setDoInput(true);
  10. connection.connect();
  11. InputStream inputStream = connection.getInputStream();
  12. output = BitmapFactory.decodeStream(inputStream);
  13.  
  14. Log.d(TAG, "_log: output size "+output.getByteCount());
  15. } catch (MalformedURLException e) {
  16. e.printStackTrace();
  17. Log.d(TAG, "_log: output with MalformedURLException "+e.toString());
  18. } catch (IOException e) {
  19. Log.d(TAG, "_log: output with IOException "+e.toString());
  20. e.printStackTrace();
  21. } catch (Exception e) {
  22. Log.d(TAG, "_log: output with Exception "+e.toString());
  23. e.printStackTrace();
  24. } finally {
  25. if (output != null) util.setupWallpaper(context, output);
  26. else Log.d(TAG, "_log: output is null");
  27. }
  28. return null;
  29. }
  30.  
  31. output with Exception java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getByteCount()' on a null object reference
  32.  
  33. RetrieveFeed.doInBackground(RetrieveFeed.java:57)
  34. RetrieveFeed.doInBackground(RetrieveFeed.java:27)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement