title: listview not updating in broadcast receiver onReceive
body: <p>as a test, I'm trying to set an icon when a text gets sent, but the icon isn't changing with the status.  I put a log in the same call and the log is printing but the icon still doesn't update.</p>
  
  <p>I register the broadcast receivers in onResume:</p>
  
  <pre><code>smsSentReceiver = new BroadcastReceiver() {
      @Override
      public void onReceive(Context arg0, Intent arg1) {
  
          final int passedSentExtra = arg1.getIntExtra("SENT_EXTRA", -1);
          Log.d("Pete Debug", "passedSentExtra = " + String.valueOf(passedSentExtra));
  
          switch (getResultCode()) {
              case Activity.RESULT_OK:
                  Log.d("Pete Debug", "Sent " + smsStatusItems.get(passedSentExtra).getMessage());
                  break;
              case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
                  smsStatusItems.get(passedSentExtra).setImage(R.drawable.fail);
                  smsStatusAdapter.notifyDataSetChanged();
                  break;
              case SmsManager.RESULT_ERROR_NO_SERVICE:
                  smsStatusItems.get(passedSentExtra).setImage(R.drawable.fail);
                  smsStatusAdapter.notifyDataSetChanged();
                  break;
              case SmsManager.RESULT_ERROR_NULL_PDU:
                  smsStatusItems.get(passedSentExtra).setImage(R.drawable.fail);
                  smsStatusAdapter.notifyDataSetChanged();
                  break;
              case SmsManager.RESULT_ERROR_RADIO_OFF:
                  smsStatusItems.get(passedSentExtra).setImage(R.drawable.fail);
                  smsStatusAdapter.notifyDataSetChanged();
                  break;
          }
      }
  };
  
  smsDeliveredReceiver = new BroadcastReceiver() {
  
      @Override
      public void onReceive(Context arg0, Intent arg1) {
  
          final int passedDeliveredExtra = arg1.getIntExtra("DELIVERED_EXTRA", -1);
          Log.d("Pete Debug", "passedDeliveredExtra = " + String.valueOf(passedDeliveredExtra));
          switch (getResultCode()) {
              case Activity.RESULT_OK:
                  Log.d("Pete Debug", "Delivered " + smsStatusItems.get(passedDeliveredExtra).getMessage());
                  smsStatusItems.get(passedDeliveredExtra).setImage(R.drawable.pass);
                  smsStatusAdapter.notifyDataSetChanged();
                  break;
              case Activity.RESULT_CANCELED:
                  smsStatusItems.get(passedDeliveredExtra).setImage(R.drawable.fail);
                  smsStatusAdapter.notifyDataSetChanged();
                  break;
          }
      }
  };
  
  //---when the SMS has been sent---
  getActivity().registerReceiver(smsSentReceiver, new IntentFilter(SMS_SENT));
  
  //---when the SMS has been delivered---
  getActivity().registerReceiver(smsDeliveredReceiver, new IntentFilter(SMS_DELIVERED));
  </code></pre>
  
  <p>I have a for-loop that's sending the texts on a button click.  Click the button, it sends a text to each selected contact.  a dialog appears that displays the status for each contact which is where the icon appears...</p>
  
  <pre><code>protected void sendingSmsDialogBeforeKitKat() {
  
          final Dialog smsSendingDialog = new Dialog(getActivity());
          smsSendingDialog.setContentView(R.layout.dialog_send_sms_status);
          smsSendingDialog.setTitle("Journey's End - Sending");
          smsSendingDialog.setCancelable(false);
  
          ListView listView = (ListView) smsSendingDialog.findViewById(R.id.lv_sms_status);
  
          smsStatusItems = new ArrayList&lt;SmsStatusItems&gt;();
          smsStatusAdapter = new SmsStatusAdapter(getActivity(), smsStatusItems);
  
          // set the exp list adapter to the exp listview
          listView.setAdapter(smsStatusAdapter);
  
          for (int i = 0; i &lt; getSelectedNumbers().size(); i++) {
              Log.d("Pete Debug", "value of i = " + String.valueOf(i));
  
              String number = removeSpecialCharacters(getSelectedNumbers().get(i));
              String smsSending = "Sending to " + number + "... ";
              Log.d("Pete Debug", smsSending);
  
              statusItems = new SmsStatusItems();
              statusItems.setMessage(smsSending);
              statusItems.setImage(R.drawable.clock);
              smsStatusItems.add(statusItems);
              smsStatusAdapter.notifyDataSetChanged();
  
              sentIntent = new Intent(SMS_SENT);
              sentIntent.putExtra("SENT_EXTRA", i);
  
              deliveredIntent = new Intent(SMS_SENT);
              deliveredIntent.putExtra("DELIVERED_EXTRA", i);
  
              mSmsManager.sendTextMessage(number, null, getFinalMessage(), (PendingIntent.getBroadcast(getActivity(), 0,
                      sentIntent, 0)), (PendingIntent.getBroadcast(getActivity(), 0,
                      deliveredIntent, 0)));
          }
          smsSendingDialog.show();
          Button okButton = (Button) smsSendingDialog.findViewById(R.id.sms_status_ok_button);
          okButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  getActivity().unregisterReceiver(smsSentReceiver);
                  getActivity().unregisterReceiver(smsDeliveredReceiver);
                  smsSendingDialog.dismiss();
                  getActivity().finish();
              }
          });
      }
  </code></pre>
  
  <p>Here's the adapter that controls the listview in that dialog...</p>
  
  <pre><code>public class SmsStatusAdapter extends BaseAdapter {
  
      private Context mContext;
      private ArrayList&lt;SmsStatusItems&gt; mData;
      private ViewHolder viewHolder;
  
      public SmsStatusAdapter(Context context, ArrayList&lt;SmsStatusItems&gt; data) {
  
          mContext = context;
          mData = data;
      }
  
      @Override
      public int getCount() {
          return mData.size();
      }
  
      @Override
      public SmsStatusItems getItem(int position) {
          return mData.get(position);
      }
  
      @Override
      public long getItemId(int position) {
          return position;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
  
          if (convertView == null) {
  
              LayoutInflater inflater = (LayoutInflater) mContext
                      .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              convertView = inflater.inflate(R.layout.sms_status_list_item, null);
  
              viewHolder = new ViewHolder();
              viewHolder.textView = (TextView) convertView.findViewById(R.id.tv_sms_status);
              viewHolder.imageView = (ImageView) convertView.findViewById(R.id.iv_sms_status_icon);
  
              convertView.setTag(viewHolder);
          } else {
  
              viewHolder = (ViewHolder) convertView.getTag();
          }
  
          viewHolder.textView.setText(getItem(position).getMessage());
          viewHolder.imageView.setImageResource(getItem(position).getImage());
  
          return convertView;
      }
  
      public class ViewHolder {
  
          TextView textView;
          ImageView imageView;
      }
  }
  </code></pre>