Projects > cpp > Issues > Bug #3669

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

CCLabelTTF - sometimes rendering as black boxes on Android

Bug #3669 [Closed]
Sheado 2014-01-10 20:00 . Updated about 2 years ago

From time to time, if I exit my game on Android while text is being displayed with CCLabelTTF, then when I re-enter the game, the text is replaced with black boxes. I’m guessing the texture is getting lost. All other textures are fine though.

Another way to reproduce the issue:
# start game
# launch some activity (such as an interstitial ad)
# close that activity and return to game
# at this point, have CCLabelTTF display some text ==> here the text is just black boxes

Also, here’s a related forum post in which more than one developer have experienced this issue:

before.png - before (20.8 kB) wollf, 2014-03-10 18:45

after.png - after (30.6 kB) wollf, 2014-03-10 18:45

Sheado 2014-01-10 22:51


After tinkering I found the cause of the problem.
I was preparing my CCLabelTTF in applicationWillEnterForeground(). Simply moving the code to a runAction(…callfunc…) fixes the problem.

I don’t know if this is a bug or if the documentation just needs to be updated to warn people that they should schedule the work to be done on resuming the application.

wollf 2014-03-10 18:45

Problem exists with new Label::createFromTTF. If i create a label label like so:
Label::createWithTTF(fontBig,"Example ttf text",TextHAlignment::RIGHT);
I hide app to background (pressing HOME button) and when i re-enter it i get "white boxes".
normal label:
after re-entering:

I think this is caused by not reloading ttfConfig created resources in reloadAllTextures.
This is bad and must be fixed, though i can't deal with this myself :(
Tested Device: Google Nexus 7(2013)

yaxinhoo 2014-04-19 08:02

@Sheado i got the same , does it fixed?

WenHai 2014-06-05 02:52

Hi guys,which version of Cocos2d-x are you using?

aleiard 2014-10-06 01:28

I'm using cocos2d-x ver3.2 and got the same issue, I think...
I'm newbie and I might just be doing something wrong but I'll report.
Is this problem already fixed in the newer versions?

-What I did
Use ui::Text to show some text on the screen (created with Cocos Studio)
Use jni and send an Intent to use the camera with startActivityForResult.
Call a c++ method in onActivityResult passing the path of the photo taken as a string.
Make a new ui::Text and show the path of the photo on the screen.

-What Happens
The ui::Text that was already on screen and the new ui::Text both become black boxes.

-When this problem doesn't occur
For me the problem doesn't occur when I don't do anything when returning from the java side.
(When I just use startActivity instead of startActivityForResult, in which case I can't access the photo...)

-Another situation this problem occurs
The problem also occurs if I try to move to a new scene in the c++ method called from onActivityResult. 2014-10-08 02:54

Redmine issue system is closed, we are using github issue system instead.

This issue was moved to

Atom PDF

Start date:2014-01-10
Due date:
% Done:


Target version:-

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.