title: How can I refresh the arraylist after remove element?
body: <p>I have class extended from listactivity, and contain arraylist of hashmap
  I can remove the element from data base, but I can't view the update until to switch to another activity and return to it.</p>
  
  <p>How can I refresh the arraylist after each remove?</p>
  
  <p>the code :</p>
  
  <pre><code>public class RemoveEvent extends ListActivity {
  
      DBAdapter DB = new DBAdapter(this);
      ArrayList&lt;HashMap&lt;String, String&gt;&gt; mylist;
      RemoveArrayAdapter n;
      SimpleAdapter mSchedule;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          mylist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
          mSchedule = new SimpleAdapter(this, mylist, R.layout.row, new String[] {
                  "NoEnent", "Date", "Time" }, new int[] { R.id.TRAIN_CELL,
                  R.id.FROM_CELL, R.id.TO_CELL });
  
          DB.open();
          Cursor c = DB.selectId();
          c.moveToFirst();
  
          for (int i = 0; i &lt; c.getCount(); i++) {
  
              HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
              map.put("NoEnent", c.getString(0));
              map.put("Date", c.getString(1));
              map.put("Time", c.getString(2));
              mylist.add(map);
  
              c.moveToNext();
          }
  
          mSchedule.notifyDataSetChanged();
          n = new RemoveArrayAdapter(this, mylist);
  
          setListAdapter(n);
  
      }
  
      public void are_u_sure(int position) {
          final int p = position;
          AlertDialog.Builder message = new AlertDialog.Builder(this);
          message.setMessage("Are you sure you want to remove this event?");
          message.setCancelable(false);
          message.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
  
              public void onClick(
                      @SuppressWarnings("unused") final DialogInterface dialog,
                      @SuppressWarnings("unused") final int id) {
  
                  HashMap&lt;String, String&gt; ob;
                  String s[] = new String[3];
                  ob = (HashMap&lt;String, String&gt;) mylist.get(p);
                  Iterator myVeryOwnIterator = ob.keySet().iterator();
                  int i = 0;
                  while (myVeryOwnIterator.hasNext()) {
                      String key = (String) myVeryOwnIterator.next();
                      String value = (String) ob.get(key);
                      s[i] = value;
                      i++;
  
                  }
                  DB.open();
                  DB.del_spec(s[0], s[1], s[2]);
  
              }
          });
          message.setNegativeButton("No", new DialogInterface.OnClickListener() {
  
              public void onClick(final DialogInterface dialog,
                      @SuppressWarnings("unused") final int id) {
                  dialog.cancel();
              }
          });
          final AlertDialog alert = message.create();
          alert.show();
  
      }
  
      @Override
      protected void onListItemClick(ListView l, View v, int position, long id) {
  
          // get selected items
          are_u_sure(position);
  
      }
  
  }
  </code></pre>
  
  <p>the code of RemoveArrayAdapter :</p>
  
  <pre><code>public class RemoveArrayAdapter extends ArrayAdapter&lt;HashMap&lt;String, String&gt;&gt; 
  {
      private final Context context;
      private final ArrayList&lt;HashMap&lt;String, String&gt;&gt; values;
     public View vv;
  
      public RemoveArrayAdapter(Context context, ArrayList&lt;HashMap&lt;String, String&gt;&gt; values) {
          super(context, R.layout.removeevent, values);
          this.context = context;
          this.values = values;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent)
      {
          LayoutInflater inflater = (LayoutInflater) context
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          View rowView = inflater.inflate(R.layout.removeevent, parent, false);
          TextView textView = (TextView) rowView.findViewById(R.id.TRAIN_CELL);
          TextView textView2 = (TextView) rowView.findViewById(R.id.FROM_CELL);
          TextView textView3 = (TextView) rowView.findViewById(R.id.TO_CELL);
          ImageView imageView = (ImageView) rowView.findViewById(R.id.logo);
          textView.setText(values.get(position).get("NoEnent"));
          textView2.setText(values.get(position).get("Date"));
          textView3.setText(values.get(position).get("Time"));
          // I'm guessing you want to modify the Logo?!? if yes pass another ArrayList to this adapter
         //contaning the info to set the ImageView
  
          return rowView;
      }
  
  }
  </code></pre>