我有一个静态字符串变量,用于将数据从另一个类发送到服务器。
我要发送的消息包含由字符“|”分隔的 5 个字符串字段(其中一个是 base64 编码的位图字符串)。
我的问题是字符串刚刚从中间剪断。我看到的唯一部分是第一个字段和 base64 编码位图(可能甚至不是全部)。
我尝试使用 MessageFormat、String.format 和常规字符串连接创建字符串,但似乎都没有。
有谁知道为什么?
这是我当前的代码:
toSend = "UPL|" + photo +"|" + Double.toString(location.latitude) + "|" +
Double.toString(location.longitude) + "|" + mapName;
logcat 打印:
UPL|iVBORw0KGgoAAAANSUhEUgAAAPwAAAC9CAIAAAAYzYf5AAAAA3NCSVQICAjb4U/gAAAgAElEQVR4 nGy97a4kWXIcaGZ+IvPeqq7uGQ6JoSgQAveHnnCx+7ILCCssJGqGmuEM++tmhpvtDz+RVdTuBRqo rrr5FeHH3dzM3JP/8PsbHUlIGEf1lG6N+FxLH2dX1W3d209JtgEIfPRZVYWgcWDxtrqfB2XgdEsy YZ+sdZgAHukVQkWmuyUBejgSFkgSgKSH+whJ0kkCGoAMiNJayAdT0Ud6qZLYvtcCkDQcKB+sm6q7 b0Ao20u0Lek8z6qDDskz57woySQAjCbJKESIBdmGOL8gsOOlMgLAtkCI9ll1pM0SyYQAkpBJe0mQ bDOZj4XrhyTskPNsJEOvKme/nwrm7XT3ojokecIHC7TtQHMvgiZZKANH1bMbYndLMCItOGJIPt2LUgAkEtodqpAEkQqJOxYLyaISnugKzAQssR2SIeB0p6rgdKxVdAM5k7WWz54busAk0X7pAgE8432d OiwBgPMADruLdGBKq+1a+3rChJLEEIDuJ0lJv6IVfOJKYjSAn+KSnJKU9gE9+rEEE4gmouq33y2R BIqq41BQFAEuOb1WHVo8+4RJPs+zJIIlnPCdxxMm0bCCtlso6ulnlQAFeKaXcMeyKKDdAIo6pCKI JBC4mO528Lbk05KSRABJViLHHzkTVjGBYMSLNUFZZMcAAeZsJGC6TcYJUYZLKwkBEySuOCSAeazE KgE5QAdV5Xhi1Am0b4AEQSFISmVbJEEFiUEIi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