how to create a callback that will be executed in appdelegate::applicationWillEnterForeground

Hi guys i’m really stack up at this part…i need you help please…thank you

Callback to what?

@dotsquid
A callback that would add a sprite in main thread using this method

const char * HelloWorld::addImage(){
	JavaVM *jvm; //this is important to avoid threading errors
	thisEnv->GetJavaVM(&jvm); //this is important to avoid threading errors
	jvm->AttachCurrentThread(&thisEnv, 0); //this is important to avoid threading errors
		//jstring jstr = thisEnv->NewStringUTF("From jni");
	jclass cls = thisEnv->GetObjectClass(thisObj);
	jmethodID method = thisEnv->GetMethodID(cls, "getPath","()Ljava/lang/String;");
	jstring result = (jstring)thisEnv->CallObjectMethod(thisObj, method);
		// call the sayHello() method
	const char * string=thisEnv->GetStringUTFChars(result, 0);
	//CCMessageBox(string,"Alert");
	//if(string!=NULL){
		CCSprite* person = CCSprite::create(string);
		    //person->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
		person->setAnchorPoint(ccp(0, -.75));
		person->setPosition(ccp(0,0));
		    this->addChild(person,204);

	return string;
}

I believe that adding a sprite this way is not safe. Can’t you create a sprite as usually and just show/hide it when it’s necessary?

@dotsquid
I can’t create a sprite that way because I need the captured image from camera to be used as a sprite.