title: java.lang.RuntimeException: Error receiving broadcast Intent
body: <p>I am using <strong>"Broadcast Receiver</strong>" very first time.
  My main theme is read notifications from status bar and display it in a listview.</p>
  
  <p>But when i am calling <em>Broadcast Receiver</em> i am getting bellow exception and app is closing with crash as a result.</p>
  
  <pre><code>07-13 14:19:49.081: E/AndroidRuntime(3985): FATAL EXCEPTION: main
  07-13 14:19:49.081: E/AndroidRuntime(3985): Process: com.kc.mobile.notifications, PID: 3985
  07-13 14:19:49.081: E/AndroidRuntime(3985): java.lang.RuntimeException: Error receiving broadcast Intent { act=NOTIFICATION_LISTENER flg=0x10 (has extras) } in com.kc.mobile.notifications.InformationList$NotificationReceiver@41e9ef18
  07-13 14:19:49.081: E/AndroidRuntime(3985):     at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:769)
  </code></pre>
  
  <p>And source code is like below::</p>
  
  <p><em>InformationList.java</em></p>
  
  <pre><code>package com.kc.mobile.notifications;
  
  import java.util.ArrayList;
  
  import android.app.Activity;
  import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;
  import android.content.IntentFilter;
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.os.Bundle;
  import android.widget.ListView;
  
  import com.kc.mobile.notifications.adapter.NotificationAdapter;
  import com.kc.mobile.notifications.util.NotificationModel;
  
  public class InformationList extends Activity
  {
      Context mContext;
  
      private NotificationReceiver nReceiver;
      public static NotificationModel mNotification;
      private ArrayList&lt;NotificationModel&gt; mNotifications = new ArrayList&lt;NotificationModel&gt;();
      ListView mList;
      private NotificationAdapter mAdapter;
  
      @Override
      protected void onCreate(Bundle savedInstanceState)
      {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.informationlist);
          mContext = getApplicationContext();
  
          nReceiver = new NotificationReceiver();
          IntentFilter filter = new IntentFilter();
          filter.addAction("NOTIFICATION_LISTENER");
          registerReceiver(nReceiver, filter);
  
          Intent broadcastIntent = new Intent("NOTIFICATION_LISTENER_SERVICEE");
          broadcastIntent.putExtra("command", "list");
          sendBroadcast(broadcastIntent);
  
      }
  
      class NotificationReceiver extends BroadcastReceiver
      {
  
          @Override
          public void onReceive(Context context, Intent intent)
          {
  
              byte[] byteArray = intent.getByteArrayExtra("icon");
              Bitmap bmp = null;
              if (byteArray != null)
              {
                  bmp = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
              }
              String pack = intent.getStringExtra("package");
              String time = intent.getStringExtra("time");
              String title = intent.getStringExtra("title");
              String desc = intent.getStringExtra("desc");
              mNotification.setmBmp(bmp);
              mNotification.setTitle(title);
              mNotification.setDesc(desc);
              mNotification.setmTime(time);
              mNotification.setPack(pack);
  
              if (mNotification != null)
              {
                  mNotifications.add(mNotification);
                  mAdapter.notifyDataSetChanged();
              }
              else
              {
                  mNotifications = new ArrayList&lt;NotificationModel&gt;();
                  mNotifications.add(mNotification);
                  mAdapter = new NotificationAdapter(getApplicationContext(), mNotifications);
                  mList = (ListView) findViewById(R.id.infolist);
                  mAdapter = new NotificationAdapter(mContext, mNotifications);
                  mList.setAdapter(mAdapter);
  
              }
          }
      }
  }
  </code></pre>