Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - kPoirier

#1
Support / Re: AddObject callback
April 10, 2013, 10:52:59 AM
In fact, I want to display a progress dialog while adding and loading an object.

I have this in my three dimensions activity :


final ProgressDialog pg = new ProgressDialog(this);
pg.setTitle("Chargement...");
pg.setCancelable(false);
pg.show();

choice.applyOn3DWorld(this.mRenderer.getWorld(), this, new CallBack() {
@Override
public void callbackSuccess() {
pg.hide();
}
@Override
public void callbackError() {
//Nothing to do
}
});


And i have this in my "Choice" class :


public void applyOn3DWorld(...){
Object3D ob3D = null;
try {
ob3D = Loader.loadSerializedObject(new FileInputStream(TabConstant.PATH_TO_3D_MODEL + ob.getFile()));
world.addObject(ob3D);
callback.callbackSuccess();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}


If i launch the code, we never see the progress dialog. It's because "callbackSuccess()" is immediately called (i suppose that "loadSerializedObject" or "addObject" works with thread).
But, on the tablet, the model appears several seconds later whereas progress dialog is already closed.

Sorry for my bad english. I'am French.

Edit :

I put a breakpoint on "pg.hide()". I should see the progress dialog. But no...
There are possible problems to show progress dialog over a GLView ?
#2
Support / AddObject callback
April 10, 2013, 09:41:01 AM
Hi,

I search a method to use a callback with a method addObject in World's class.


public void myFunction(){
  ob= Loader.loadSerializedObject(...);
  world.addObject(ob);
}


I want to display a progress dialog while my function works. But addObject seems use an other thread.

How shall we do it?

Thanks.