Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. try {
  2. Download(URL); //download picture to SD card/Download
  3. File myfile = new File(Environment.getExternalStorageDirectory() + "/Download/", filename);
  4. Drawable photo = null;
  5. photo = Drawable.createFromPath(myfile.getPath());
  6. imageview.setBackgroundDrawable(photo);
  7. }
  8.  
  9. try
  10. {
  11. Download(URL); //download picture to SD card/Download
  12.  
  13. final int THUMBNAIL_SIZE = 64;
  14.  
  15. FileInputStream fis = new FileInputStream(Environment.getExternalStorageDirectory() + "/Download/", filename);
  16. Bitmap imageBitmap = BitmapFactory.decodeStream(fis);
  17.  
  18. imageBitmap = Bitmap.createScaledBitmap(imageBitmap, THUMBNAIL_SIZE, THUMBNAIL_SIZE, false);
  19. imageview.setImageBitmap(imageBitmap);
  20.  
  21. }
  22. catch(Exception ex) {
  23.  
  24. }
  25.  
  26. Bitmap photo = Bitmap.createScaledBitmap(BitmapFactory.decodeFile(myfile.getPath()),60,60,true);
  27. imageview.setImageBitmap(photo);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement