Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. @Override
  2. public View getView(int position, View convertView, ViewGroup viewGroup) {
  3.  
  4. ImageView picturesView;
  5. if (convertView == null) {
  6. picturesView = new ImageView(context);
  7. if (list.get(position).toString().contains(".jpg")) {
  8. bitmap = BitmapFactory.decodeFile(list.get(position).toString()); //Creation of Thumbnail of image
  9. } else {
  10. if (list.get(position).toString().contains(".mp4")) {
  11. bitmap = ThumbnailUtils.createVideoThumbnail(list.get(position).toString(), 1); //Creation of Thumbnail of video
  12. }
  13. }
  14. picturesView.setScaleType(ImageView.ScaleType.CENTER_CROP);
  15. //picturesView.setPadding(8, 8, 8, 8);
  16. picturesView.setLayoutParams(new GridView.LayoutParams(200, 200));
  17. } else {
  18. picturesView = (ImageView) convertView;
  19. }
  20. picturesView.setImageBitmap(bitmap);
  21. return picturesView;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement