-1

I'm trying to add gif icon to Progress dialog setIcon using Glide. But getting error not able resolve. This is my code.

private ProgressDialog pDialog;
pDialog = new ProgressDialog(MainActivity.this);
pDialog.setTitle("Loading...");
pDialog.setIcon(Glide.with(this).asGif().load(R.drawable.loading_file));
pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
pDialog.show();

I'm newbie to Glide.

ADM
  • 20,406
  • 11
  • 52
  • 83
  • 1
    make a custom view and apply it to the progress dialog it will solve your problem. the reason that it don't work is setIcon() does not take glide as input – Ajay K S Mar 07 '22 at 02:02
  • `ProgressDialog` is deprecated long ago its better if you don't use it . Create a Custom Dialog and set icon to `ImageView` . – ADM Mar 07 '22 at 04:52

1 Answers1

1

If your source file for gif/image is already in .gif format, then you can simply just write the below code:

Glide.with(this).load(R.drawable.gif_file).into(imageView);
nilesh14k
  • 58
  • 5
  • What if dont have imageView? Anyways to load image to setIcon or else create new layout with image view & display as progress dialog?. – abhilash kaveriappa Mar 07 '22 at 02:25
  • 1
    you can use a layout inflater and add a ProgressDialgoue in your custom layout file. And you can add imageView in that custom layout file. – nilesh14k Mar 16 '22 at 15:04