1

I have a customzied ListAdapter that contains one image and 2 text Fields.

public CustomListAdapter(Activity context, String[] itemname, String[] imgid) {
        super(context, R.layout.listcateg, itemname);
    // TODO Auto-generated constructor stub

    this.context = context;
    this.itemname = itemname;
    this.imgid = imgid;

   }

public View getView(int position, View view, ViewGroup parent) {
    LayoutInflater inflater = context.getLayoutInflater();
    View rowView = inflater.inflate(R.layout.listcateg, null, true);

    TextView txtTitle = (TextView) rowView.findViewById(R.id.item);
   final ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
    TextView extratxt = (TextView) rowView.findViewById(R.id.textView1);

    txtTitle.setText(itemname[position]);
    extratxt.setText("Description " + itemname[position]);


    Glide.with(getContext())
            .load("http://..."+imgid[position])
            .asBitmap()
            .override(100, 100)
            .into(imageView);
    return rowView;

};

}

This adapter is called from an activity that contains this code :

CustomListAdapter adapter=new CustomListAdapter(this, itemname, imgid);
 list=(ListView)findViewById(R.id.catlist);
 list.setAdapter(adapter);

My issue is that , every time i open the activity for the 1st time, the activity is loaded, quickly and i have to wait around 10s for the images to show. How can i force the activity not to load until glide has finished downloading the iimages. This issue happens only the 1st time. Later on, when i close and reopen the application, the pictures are shown almost immediately (as i guess they reside in cache).

Regards.

Joe Da
  • 21
  • 4
  • Try to add .dontAnimate() before .into(imageView) , for loading image using glide, it might reduce the time for loading images – Muhib Pirani Apr 29 '17 at 15:18

1 Answers1

0

May be you could hide / show or load the activity using listener. Here is a link that could help.

Community
  • 1
  • 1
Erwin
  • 32
  • 4