Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public View getView(int position, View convertView, ViewGroup viewGroup) {
- ImageView picturesView;
- if (convertView == null) {
- picturesView = new ImageView(context);
- if (list.get(position).toString().contains(".jpg")) {
- bitmap = BitmapFactory.decodeFile(list.get(position).toString()); //Creation of Thumbnail of image
- } else {
- if (list.get(position).toString().contains(".mp4")) {
- bitmap = ThumbnailUtils.createVideoThumbnail(list.get(position).toString(), 1); //Creation of Thumbnail of video
- }
- }
- picturesView.setScaleType(ImageView.ScaleType.CENTER_CROP);
- //picturesView.setPadding(8, 8, 8, 8);
- picturesView.setLayoutParams(new GridView.LayoutParams(200, 200));
- } else {
- picturesView = (ImageView) convertView;
- }
- picturesView.setImageBitmap(bitmap);
- return picturesView;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement