Hi ,
I am using EsyAr sdk in android and IOS . I have gone through the document for `StorageType` class but did not understand much . So here i am asking .
1. Can i load target from SD card path ? if yes the which `StorageType` should i use and where should i keep all the images ?
I am trying to load all images from a Folder which is located at `/data/data/com.myapp/Targets/`. How can i achive this in android ? When i use code below its giving me error for the URL .
private void loadFromSDcard(ImageTracker tracker, String path)
{
ImageTarget target = new ImageTarget();
target.setup(path, StorageType.Absolute, "");
tracker.loadTarget(target, new FunctorOfVoidFromPointerOfTargetAndBool() {
@Override
public void invoke(Target target, boolean status) {
Log.i("AREngine", String.format("load target (%b): %s (%d)", status, target.name(), target.runtimeID()));
}
});
}
2. Can i load target from a http server url? if yes the what is the `StorageType` for this .
Please provide proper explanation for both platforms . Thanks.
EDIT:- I have done it as follows .
private void loadallFromSDcard(ImageTracker tracker, File file) {
String pre = "{\n" +
" \"images\": [\n";
String post = " ]\n" +
"}";
StringBuilder builder=new StringBuilder();
for (File file1: file.listFiles()) {
if(builder.length()==0){
builder.append("\""+file1.getAbsolutePath()+"\"");
}else{
builder.append(",\""+file1.getAbsolutePath()+"\"");
}
}
String jstr=pre+builder.toString()+post;
for (ImageTarget target : ImageTarget.setupAll(jstr, StorageType.Json)) {
tracker.loadTarget(target, new FunctorOfVoidFromPointerOfTargetAndBool() {
@Override
public void invoke(Target target, boolean status) {
Log.i("AREngine", String.format("load target (%b): %s (%d)", status, target.name(), target.runtimeID()));
}
});
}
}
Its loading targets . But i think its not the right way to do it . Can you please post code of the right way to do this in android .