Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [SOLVED]Android: Path issue

[SOLVED]Android: Path issue

Scheduled Pinned Locked Moved Mobile and Embedded
4 Posts 2 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mbnoimi
    wrote on last edited by
    #1

    I'm working on porting a desktop application to Android. This snippet doesn't work correctly under Android because of path issue (unable to extract a file from app. resource to app path).

    May you please guide me how to fix path issue under Android?

    [code]void MainWindow::on_pushButton_clicked()
    {
    QString filePath = qApp->applicationDirPath() + QDir::separator() + "scheme.xml";
    if (!QFile::exists(filePath)) {
    QFile::copy("://scheme.xml", filePath);
    }
    QString data;
    QFile file(filePath);
    file.open(QFile::ReadOnly);
    data = QVariant(file.readAll()).toString();
    ui->textEdit->setText(data+"\nENDED");
    }[/code]

    BTW, I'm using Qt 5.1.0 & Qt Creator 2.7.2 under Ubuntu 13.04

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AlterX
      wrote on last edited by
      #2

      Hello, despite it is for sqlite file, it can be used for all files...on android things work a little bit different:
      "here":http://qt-project.org/forums/viewthread/29855/

      Qt Ambassador
      Real-time cooperative teams: http://www.softairrealfight.net
      Free Real-time network platform sdk: https://github.com/AlterX76/Solomon

      https://codereview.qt-project.org/...

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mbnoimi
        wrote on last edited by
        #3

        Works like a charm... thanks a lot

        1 Reply Last reply
        0
        • A Offline
          A Offline
          AlterX
          wrote on last edited by
          #4

          :)
          we all are glad when we can help each other!

          Qt Ambassador
          Real-time cooperative teams: http://www.softairrealfight.net
          Free Real-time network platform sdk: https://github.com/AlterX76/Solomon

          https://codereview.qt-project.org/...

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved