像这样的代码:
JSONObject contentObject = new JSONObject(content);
JSONObject params = contentObject.getJSONObject("response_params");
Log.d("onTest", "channel_id:" + params.getString("channel_id"));
Log.d("onTest", "channel_id:" + params.getLong("channel_id"));
日志打印:
08-21 12:46:21.470: DEBUG/onTest(25228): onMessage: content : {"response_params":{"appid":"1071410","channel_id":"3537275240990320342","user_id":"714893193627619861"},"request_id":1293438498}
08-21 12:46:21.480: DEBUG/onTest(25228): channel_id:3537275240990320342
08-21 12:46:21.480: DEBUG/onTest(25228): channel_id:3537275240990320128
为什么 getLong 的值为 3537275240990320128,而字符串的值为 3537275240990320342?