Too much text

I have got another issue!  :frowning:

in my app i charge a big text (2000 char)…

in all of my devices the text charged correctly, but in htc one the text doesn’t appear! (if I print it in log the text is complete)

if I reduce length it work…

but for my app i need long text…

Some helps?  :smiley:

The text is actually an image behind the scenes. So the problem is that with a huge image object, your most likely exceeding the maximum texture size of that device.

It will probably be a good idea to split the text into a few text objects.

with my old HTC Sensation the text is displayed full…

in new HTC One no… :frowning:

in simulator work

in iOs work

in other Android device work

why does only on htc one not work?

Different devices have different texture size limitations

What piotrz said and what I said in my first reply. Split the text up into two text objects and see if it works.

Thats the first key to debugging this.

Also are you running adb logcat? If so that will/should tell you what the cause was.

Split up the text. :wink:

yes by splitting text in 1500 char work…

but I put this text on a scrollview…

how do I put this text so that it is separated at the end of a sentence? 

and especially how i put inside the scrollView?

Just put the second text object inside the scrollview as you did for the first one. As for positioning, just position it below the first text object, where you use the first text objects height to determine where to place the second object.

Have you gone through the beginner tutorials on Corona University? If not I think they would really help you, before jumping in the deep end :wink:

but it can’t work… because I have text of random length…

it can be 1000, 1500, 2000, 3000, 4000, 5000…

i need a function that split text every 1500 char?

is there any possibility to increase texture size limitation instead?

thanks

You can’t increase the texture size as it’s a device gpu limitation. Nothing can change it.

Sounds like you need to make a function then. One that checks the string length and splits it if it’s over a certain range. You can also use system.getInfo( “maxTextureSize” ) to see what max texture size the device can handle. docs > http://docs.coronalabs.com/daily/api/library/system/getInfo.html

So a quick rough idea would be to do this:

  1. Create your text as a whole object or better, calculate how large the text object would be given the font size and number of characters. Because I believe that if the text cannot be created then it will not give you a width/height and instead return nil. 

  2. Check if the text’s width/height exceed the device’s max texture size.

  3. Create the text, splitting it into as many objects as needed.

i’m calculating the maxTextureSize as you say:

  • htc one 4096

  • htc sensation 4096

the strange thing is that on Sensation it work!!

But you said you have “random text length” you are you sure that you are displaying the exact same number of characters on the Sensation as you are on the HTC One?

yes, i’m sure

there are various description file that i charge and print…

the same in any device…

Ok, well this is just speculation (I haven’t done any research into either phone) but it could be the case that they handle images that exceed their texture size limit differently. For instance the sensation may be downsizing images that exceed it’s texture limit, whilst the htc one may just refuse to load them. 

Again that is just speculation but could explain why it’s showing on one device and not the other. Even though they both appear to have the same texture limit.

maybe it depends on their screen resolution??

In my case it doesn’t appear any error log!

I readed in this forum http://forums.coronalabs.com/topic/43646-is-it-possible-to-know-if-the-text-is-too-long-for-displaynewtext/ that a warning had to appear…

i did the split as you say!

thanks  Gremlin Interactive

The text is actually an image behind the scenes. So the problem is that with a huge image object, your most likely exceeding the maximum texture size of that device.

It will probably be a good idea to split the text into a few text objects.

with my old HTC Sensation the text is displayed full…

in new HTC One no… :frowning:

in simulator work

in iOs work

in other Android device work

why does only on htc one not work?