By kssboti
on Tue, 07/17/2012 - 15:27
Hello!
I would like to store the datasets on the sd card. This way i will be able to change them without having to reinstall the application. The question is, how can i reach the sd card from the native code? As i understand this is how the dataset loads from the assets folder: dataSetStonesAndChips->load(s, QCAR::DataSet::STORAGE_APPRESOURCE). The problem is that the assets folder is read-only during runtime, so i cannot change the datasets there, that's why i have to use the sd card.
Thanks
storing dataset on sd card
To access the SDCard you can use STORAGE_ABSOLUTE and specify an absolute path to the datasets. This will typically be /sdcard/.. but you should confirm this as not all devices use the same path.
see:
storing dataset on sd card
How should i declare the parameter? I modified the native loadTrackerData method and added a const char* extra parameter as the absolute path to the dataset file. I have to right path, because i get it with Environment.getExternalStorageDirectory().
storing dataset on sd card
I have found the solution. It wasn't working because the java and the c objects are not compatible with each other. I had to convert the Java object (jstring) into a c object (const char*). The ndk has methods for conversion. Now it's working.
storing dataset on sd card
I'm trying to manage same thing, but i have a problem with saving path.
I'm saving tracker to this path on java:
storing dataset on sd card
Ok. I've managed that by transfering string to native code in ImageTargets.java by changing loadTrackerData method:
storing dataset on sd card
this is useful, thanks..
but can you help me in making reading datasets dynamically from a list of XMLs which changing from time to time, i can send the xml file name as you explained by doin this with an action on a menu item, but i need help how can i apply that in the .cpp code?
storing dataset on sd card
You should parse the XML document in Java, to obtain the paths of your datasets, and then pass these using the approach the yaya has demonstrated below.
storing dataset on sd card
example Train2.xml
how can you know dynamically the name for the new xml to be loaded?