Glide cannot show image URL in Dialog Listview item ImageView item

83 views Asked by At

Show list of Guard in ListView with Image.

Used Target, ImageViewTarget, and DrawableImageViewTarget but all not working

Show ListView in Dialog

Dialog dialog = new Dialog(CameraActivityForCheckInOut.this);    
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
dialog.setContentView(R.layout.dialog_list);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));    
btnCloseDialog = dialog.findViewById(R.id.close_button);
listViewDialog = dialog.findViewById(R.id.list);    
btnCloseDialog.setOnClickListener(v -> {
stopAudio();
resumeFaceRecognition();
});    
Adapter adapter = new adapter(list);
listViewDialog.setAdapter(adapter);
setListViewHeightBasedOnChildren(listViewDialog);
dialog.setCancelable(false);
dialog.show();

ListView Adapter's getView():

    public View getView(final int position, View view, ViewGroup parent) {
            final ViewHolder holder;
            if (view == null) {
                holder = new ViewHolder();
                view = inflater.inflate(R.layout.list_row, null);
                holder.imageView = view.findViewById(R.id.Image);
                view.setTag(holder);
            } else {
                holder = (ViewHolder) view.getTag();
            }
            try {
                Person person = persons.get(position);
                try {
                    String url = person.getProfileURL();

 Glide.with(activity).load(url).centerCrop().placeholder(R.mipmap.person).fallback(R.mipmap.person).error(R.mipmap.person).into(holder.imageView);
                } catch (Exception e) {
                    e.printStackTrace();
                }   
            } catch (Exception e) {
                e.printStackTrace();
            }
            return view;
        }

show image in listview item ImageView

0

There are 0 answers