< Development‎ | Tutorials‎ | Necessitas
Revision as of 16:58, 18 June 2012 by Bog dan ro (Talk | contribs) (Access assets)

Jump to: navigation, search

Android assets

Android assets are read-only arbitrary files bundled in their raw form into your package.Necessitas project provides seamless integration with android assets, meaning that you can access any asset files as you access any ordinary files.

Deploy assets

Before accessing an asset we need to deploy it.

# assuming you want to deploy qml/foo/main.qml file, you need to add the flowing lines to your .pro/.pri file(s)
android { #define an android block
    delployment.path=/assets/qml/foo #all assets must go to "/assets" folder of your android package
} else : maemo5 { #other platforms
INSTALLS += delployment

Access assets

QmlApplicationViewer * m_qmlAppViewer;

QFile file( "assets:/qml/foo/main.qml" ); // to open a file just use its path and add '''assets:/''' prefix

// do whatever you want with file

Content is available under Creative Commons License SA 4.0 unless otherwise noted.