java.lang.NumberFormatException:无效的int:“DEOA”

时间:2016-02-17 11:02:37

标签: android numberformatexception

我正在研究即时聊天应用程序。我使用了一组表情符号来通过我的应用程序发送表情符号。我正在使用以下代码将表情符号的unicode字符发送到服务器。

String toServer = StringEscapeUtils.escapeJava(message);

当我从服务器接收消息时,我正在使用以下代码进行解码:

 try {
                        String messageReceived = StringEscapeUtils.unescapeJava(message);
                        String date = jsonObject.getString("date");
                        Long time = Long.parseLong(date);
                        String t = getDateFromTimestamp(time);
                        Log.e("TimeC", t);
                        Log.e("Date", date);
                        isSelf = true;
                        msg = new Bean_Message(userName, messageReceived, isSelf);
                        msg.setTime(t);
                        listBeanMessages.add(msg);
                        adapter_message.notifyDataSetChanged();
                    } catch (NumberFormatException e) {
                        Log.e("Exception", String.valueOf(e));
                    }

我在解码Unicode.Log时遇到NumberFormatException,如下所示:

Caused by: java.lang.NumberFormatException: Invalid int: "DEOA"
        at java.lang.Integer.invalidInt(Integer.java:138)
        at java.lang.Integer.parse(Integer.java:375)
        at java.lang.Integer.parseInt(Integer.java:366)
        at org.apache.commons.lang.StringEscapeUtils.unescapeJava(StringEscapeUtils.java:331)
            at org.apache.commons.lang.StringEscapeUtils.unescapeJava(StringEscapeUtils.java:287)
            at com.almabay.almachat.activity.SingleChatActivity.parseJsonFeed(SingleChatActivity.java:582)
            at com.almabay.almachat.activity.SingleChatActivity$MessageTask.onPostExecute(SingleChatActivity.java:517)
            at com.almabay.almachat.activity.SingleChatActivity$MessageTask.onPostExecute(SingleChatActivity.java:505)

请帮我解决问题。

0 个答案:

没有答案