New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solving 'black screen' on android #3117
Conversation
Good to know, thanks. |
If the activity is destroyed, how about kill this program? |
A game may start a service to get push notification. If you kill the program, the service may be killed too. |
These are mostly my own findings after some time of debugging and But here are some links which helps: Activity lifecycle: Jaroslaw Lewandowski jotel@jotel.net On 10 July 2013 03:36, minggo notifications@github.com wrote:
|
Ok. |
Yes, this is another solution... you could destroy CCDirector ... but I'm Jaro Jaroslaw Lewandowski jotel@jotel.net On 10 July 2013 03:56, minggo notifications@github.com wrote:
|
Thanks @jotel. |
Hi,
On Andorid there could be a case that an Activity is Destroyed but the JNI code still stays in memory. In such case OpenGL context is recreated and all currently active CCTexture2D objects (in running scene) which have texture names from the not anymore existing OpenGL context are rendered in black or could render some other textures if the later were created in the mean time.
The typical scenario is when user changes language configuration in his/her device.
To solve that problem the textures' names need to be rebind(reloaded) based on the initial input parameters and as far as I'm aware the only way is to set CC_ENABLE_CACHE_TEXTURE_DATA to 1 and when OpenGL context is reinitiaded then call CCTextureCache::reloadAllTextures(); That way all you textures are valid again. When you have i18n application it could be a good moment to re-init the FileUtils searchPaths and searchResolutionsOrder to enable load localized resources from new locations (based in current language).
Regards
Jaro
p.s. originally i created that patch for 2.1.4 version... but then realised that some work has been done... unfortunately it didn't solve all the cases (and the one most important for me i.e. changing the device locale).. so I hope that would be useful for you.