0

I'm using a image path in my test mobile (Samsung-Duos) for platformRequest("file:///E:/image.jpg") . it seems that the file path is invalid. I have the image in the SD card. Please anyone help me to make it work !

Thanks in advance :)

prabhu
  • 1,158
  • 1
  • 12
  • 27

1 Answers1

1

Just make sure you are passing the correct path. Using below code you will able to know which are the avalable paths you have. (Music folder is you app specific folder. you can remove it if not needed.)

 private String getFullMusicPath() {
    Enumeration drives = FileSystemRegistry.listRoots();
    String root = null;
    while (drives.hasMoreElements()) {
        root = (String) drives.nextElement();
        if (root.equalsIgnoreCase("sdcard/")) {
            return "file:///" + root + musicFolder + "/";
        }
    }
    return (root == null ? null : "file:///" + root + musicFolder + "/");
}
Vishal
  • 355
  • 3
  • 18