Question

I need read .txt file on android using qt program. If build for windows, that file should be in build folder, but what about android? How to include it in apk?

Was it helpful?

Solution

You can include the text file into your APK's assets, and then refer to it like so:

QFile file( "assets:/qml/foo/main.qml" );

This question has another URI for accessing assets: How to add qt resources to android APK file?

Or you can package the QFile in your application as a QRC (http://qt-project.org/doc/qt-5.0/qtcore/resources.html) and access it like so:

QFile file( "qrc:/path/to/file.abc" );

Both of these options are read only.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top