1

I have list of file's paths which are not images. I need to load icon of every file as stored in device directory using file paths i hav. I am trying this with glide but it gives load.enguine.Exception. Is there anyway to handle this using glide?

 override fun onBindViewHolder(holder: VideoViewHolder, position: Int) {
    try {
        var a = list[position]
        var uri = Uri.parse(a)
        Glide.with(activity).load(Uri.fromFile(File(a))).into(holder.icon)
    }catch (ex: Exception){
        ex.printStackTrace()
    }
}
Sandeep Malik
  • 1,972
  • 1
  • 8
  • 17
User
  • 31
  • 5
  • 1
    Try the solution here: [Glide load local image by Uri](https://stackoverflow.com/a/32332208/1468093) – Kamran Ahmed Apr 30 '19 at 05:38
  • @KamranAhmed i have list of paths of files not actual images. i need to extaract icon of each file from this path. – User Apr 30 '19 at 05:49
  • You mean you want to show icons based on type of files, right? – Kamran Ahmed Apr 30 '19 at 09:31
  • @KamranAhmed Exactly. – User Apr 30 '19 at 10:32
  • There is no place to extract icons based on file types unless you are planning to show the default app icon that can open a particular kind of file... is that what you want to do? – Kamran Ahmed Apr 30 '19 at 13:59
  • Can you share an example of whats the content of list[position]? – Kamran Ahmed Apr 30 '19 at 14:04
  • @KamranAhmed Sorry brother for late reply. Yes it might be not possible to extract icon of file so i some how i solved it by using default icons placed in project's drawable. I appreciate your effort. – User May 03 '19 at 06:27

0 Answers0