I'm trying to activate a dataset that I read from external storage at runtime. I'm using the following code to do that and I've put it in onQCarUpdaate method in VideoPlayback.java:
TrackerManager trackerManager = TrackerManager.getInstance();
ImageTracker imageTracker = (ImageTracker) trackerManager
.getTracker(ImageTracker.getClassType());
if (imageTracker == null)
{
Log.d(
LOGTAG,
"Failed to load tracking data set because the ImageTracker has not been initialized.");
result = false;
}
imageTracker.stop();
// Create the data sets:
dataSetStonesAndChips = imageTracker.createDataSet();
if (dataSetStonesAndChips == null)
{
Log.d(LOGTAG, "Failed to create a new tracking data.");
result = false;
}
// Load the data sets:
if (!dataSetStonesAndChips.load(mTrackersDataPath,
STORAGE_TYPE.STORAGE_ABSOLUTE))
{
Log.d(LOGTAG, "Failed to load data set.");
result = false;
}
// Activate the data set:
if (!imageTracker.activateDataSet(dataSetStonesAndChips))
{
Log.d(LOGTAG, "Failed to activate data set.");
result = false;
}
Log.d(LOGTAG, "Successfully loaded and activated data set.");
boolean wasActivate = (imageTracker.getActiveDataSet() == dataSetStonesAndChips);
int count = imageTracker.getActiveDataSetCount();
My problem is that wasActiated is false eventhough count is equal to 1. I tried getting the active dataset by index but nothing changed. If I put this code in doLoadTrackersData method then wasActivated is true but not here.
Also the dataset is infact correctly activated since the application works fine but to unload the dataset I need to fix this problem. Right now if I try deactivating and destroying the dataset my app crashes.
0 comments:
Post a Comment