Problem using Qt's JNI interface, No valid jobjects

  • Hello,

    I am trying to call SQLiteDatabase's function "SQLiteDatabase openOrCreateDatabase (String path, SQLiteDatabase.CursorFactory factory)" (Andoird, see the link below), android.database.sqlite.SQLiteDatabase.CursorFactory)

    This is the way I tried it:

    qDebug() << "Object valid?: " <<
                                       QAndroidJniObject::fromString("data/data/<full appname>/databases/SomeDatabase.sqlite")

    But the ouput says "Object valid?: false". So now my question, whats the probem here?
    Or maybe there is a better way to solve my problem in gerneral. I want to use a sqlite database on Andoird. I can create the database, but I cannot save it to the local file system for some reason. So I tried it this way.

  • You can use Qt libaries(QSqlDatabase, QSqlQuery) and they works just fine, had no problems with them.
    About saving file use library QStandardPaths to get path to documents and save the file there. On mobile devices there are some restrictions about directories where you can save your files.

    Hope it helps.

  • Thank you, with the StandardPaths's its working with QSqlDatabase.
    But does anybody know how to solve the above mentioned problem?