title: Android ListView does not update onResume
body: <p>I made an Activity for searching people that also shows history of recent research.</p>
  
  <p>If I long click on an item of the history it asks me if I want to delete it. If I press "Yes" it deletes the list item.</p>
  
  <p>So, I write something and click to "Search" button. This brings me in another Activity with results. Here I click on result so it stores the person info and brings me in the person page.</p>
  
  <p>When I come back I don't see the new person in the history.</p>
  
  <p>So I overwritten onResume() but it still not work and now I cannot delete items from the history list.</p>
  
  <p>Here the code:</p>
  
  <pre><code>package com.lpsmt.proffinder;
  
  import java.util.List;
  
  import android.app.Activity;
  import android.app.AlertDialog;
  import android.content.DialogInterface;
  import android.content.Intent;
  import android.content.res.Resources;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemLongClickListener;
  import android.widget.EditText;
  import android.widget.ListView;
  import android.widget.Toast;
  
  import com.lpsmt.R;
  
  public class HomeActivity extends Activity
  {
      protected Db db = null;
      protected List&lt;ProfBean&gt; historyProfs = null;
      protected ProfListItemAdapter listAdapter = null;
      protected ListView listView = null;
  
      protected void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          this.db = new Db(this);
  
          this.setContentView(R.layout.prof_finder_home);
  
          this.historyProfs = this.db.getHistory(-1); // -1 means with no limits
          this.listAdapter = new ProfListItemAdapter(HomeActivity.this, R.id.prof_finder_history_list_view, this.historyProfs);
  
          this.listView = (ListView) this.findViewById(R.id.prof_finder_history_list_view);
          listView.setAdapter(this.listAdapter);
  
          listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                  Intent intent = new Intent(HomeActivity.this, ProfPageActivity.class);
                  Bundle bundle = new Bundle();
                  bundle.putString("profId", HomeActivity.this.historyProfs.get(position).getProfId());
                  intent.putExtras(bundle);
                  HomeActivity.this.startActivity(intent);
              }
          });
  
          listView.setOnItemLongClickListener(new OnItemLongClickListener() {
              @Override
              public boolean onItemLongClick(AdapterView&lt;?&gt; parent, View view,
                                             int position, long id)
              {
                  Resources resources = HomeActivity.this.getResources();
                  String title = resources.getString(R.string.prof_finder_history_delete_title);
                  String message = resources.getString(R.string.prof_finder_history_delete_message);
                  AlertDialog.Builder adb=new AlertDialog.Builder(HomeActivity.this);
                  adb.setTitle(title);
                  adb.setMessage(message);
  
                  final int positionToRemove = position;
                  String positive = resources.getString(R.string.prof_finder_history_delete_positive);
                  String negative = resources.getString(R.string.prof_finder_history_delete_negative);
                  adb.setNegativeButton(negative, null);
                  adb.setPositiveButton(positive, new AlertDialog.OnClickListener() {
                      public void onClick(DialogInterface dialog, int which) {
                          ProfBean prof = HomeActivity.this.historyProfs.get(positionToRemove);
                          HomeActivity.this.db.deleteProf(prof.getProfId());
  
                          HomeActivity.this.historyProfs.remove(positionToRemove);
                          HomeActivity.this.runOnUiThread(new Runnable() {
                              public void run() {
                                  HomeActivity.this.listAdapter.notifyDataSetChanged();
                              }
                          });
                      }});
                  adb.show();
  
                  return true;
              }
          });
      }
  
      public void searchProf(View view) throws Exception
      {
          EditText queryEditText = (EditText) this.findViewById(R.id.prof_finder_search_query);
          String query = queryEditText.getText().toString().trim();
          queryEditText.setText(query);
  
          if (query.length() &lt; 3) {
              String message = this.getResources().getString(R.string.prof_finder_query_too_short);
              Toast.makeText(this, message, Toast.LENGTH_LONG).show();
              return;
          }
  
          Intent intent = new Intent(HomeActivity.this, SearchResultActivity.class);
          Bundle bundle = new Bundle();
          bundle.putString("query", query);
          intent.putExtras(bundle);
          this.startActivity(intent);
      }
  
      public void onResume()
      {
          super.onResume();
  
          this.historyProfs = this.db.getHistory(-1);
          this.listAdapter.notifyDataSetChanged();
      }
  }
  </code></pre>