Android错误接收广播意图{act = Take_Message flg = 0x10(有附加内容)}

时间:2015-04-26 06:32:51

标签: android broadcastreceiver

下面是我的BroadcastReceiver代码,我收到此错误:

 public class MessageReceiver extends BroadcastReceiver {

            @Override
            public void onReceive(Context context, Intent intent) {
                Bundle extra = intent.getExtras();
                String username = extra.getString(MessageInfo.USERID);
                String message = extra.getString(MessageInfo.MESSAGETEXT);

                if (username != null && message != null) {
                    if (friend.userName.equals(username)) {
                        myarray.add(username + ":" + "\n" + message);
                        adapter.notifyDataSetChanged();
                        localstoragehandler.insert(username,
                                imService.getUsername(), message);

                    } else {
                        if (message.length() > 15) {
                            message = message.substring(0, 15);
                        }
                        Toast.makeText(Messaging.this,
                                username + " says '" + message + "'",
                                Toast.LENGTH_SHORT).show();
                    }
                }
            }

        };

Logcat消息:

  

java.lang.RuntimeException:在com.android.app.Messaging$MessageReceiver@535d151c中接收广播Intent {act = Take_Message flg = 0x10(有额外内容)}时出错

0 个答案:

没有答案