Search code examples
androidqtqfile

Android - Open file with QFile


After recording a video with the Camera on an Android device, the actualLocation is file:///storage/emulated/0/DCIM/VID_00000012.3gp

How can I open it?

  QFile videoLocation;
  videoLocation.setFileName(actualLocation);
  if (videoLocation.open(QIODevice::ReadOnly)) {
      ...
  }
  else {
      qDebug() << videoLocation.errorString();
  }

The open method fails and the errorString prints No such file or directory


Solution

  • QFile expects a path, not an URL. Try removing the file:// at the beginning.