在Android的一个字符串变量的最大长度 [英] Max length of a string variable in Android

查看:2684
本文介绍了在Android的一个字符串变量的最大长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎有一个最大长度的字符串可以有多少个字符持有。在我的情况下,它正在通过JSON填充了HTML,并在约1500个字符崩溃。

There seems to be a max length to how many chars a string can hold. In my case it’s being populated with HTML via JSON and at around 1500 chars it crashes.

有在距HTML文本没有特殊字符。

There are no special characters in the text apart from HTML.

有没有解决的办法还是这样吗?

Is there a way around this or is that it?

干杯,

麦克。

推荐答案

的最大值(实践和理论)要高得多。从理论上讲,这是2 ^ 31 - 1个字符。在实践中,你将是有限的可用内存,但即使在移动系统中,你将有超过1.5KB。

The maximums (both practical and theoretical) are far higher. Theoretically, it's 2^31 - 1 characters. In practice, you'll be limited to available memory, but even on a mobile system you'll have more than 1.5KB.

您有一个不同的问题。使用 JSON林特来,你有有效的JSON首先检查。

You have a different issue. Use JSON Lint to first check that you have valid JSON.

这篇关于在Android的一个字符串变量的最大长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆