In my Android program I have many arrays and lists storing a few hundred strings each. I will sometimes get a string from one of these structures and use it to draw text to the screen programmatically (example below).
String displayText = titleList[i];
renderText(displayText);
Everything renders as expected on my current device. I wanted to support it back to jelly bean (api 16-18) but on my jelly bean device, the strings will sometimes not render to the screen or will only render the first half or will render a few strings but not the rest in a list. Logging the value of these strings passed to the renderer prints as expected. The odd thing is that if I build a new string from the referenced string (example below), it works!
String displayText = new String(titleList[i]);
renderText(displayText);
I could do this, but it seems like it would be wasteful and might impact performance to build new strings every time I reference one that already exists, especially since it works on newer devices. And Android Studio tells me I'm stupid ("new String is redundant"). I'm also just curious how this is even possible and would like a better way to fix it.