Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top