Stack Exchange
Android Error receiving broadcast Intent { act=Take_Message flg=0x10 (has extras) }
Below there is my BroadcastReceiver code where I'm getting this error:
 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 message :

java.lang.RuntimeException: Error receiving broadcast Intent { act=Take_Message flg=0x10 (has extras) } in com.android.app.Messaging$MessageReceiver@535d151c


Now try to read your "question" twice and understand that it impossible to answer without reading your thoughts.

edited please help if can

Please add the full stack trace. There is more useful data in the logcat, like the actual cause of the problem.
