title: listview with simpleadapter not refreshing after adding new data to sqlite database
body: <p>I have a problem with my listview that when I add a task to my database, I need to update my listview with this new added task....</p>
  
  <p>I'm new to android and Eclipse... </p>
  
  <p>Here is my code for Main (that shows the <code>ListView</code>)</p>
  
  <pre><code>public class Main extends ListActivity {
  
      Button newCat;
      TextView todaytaskId;
      ResultDatabase controller5 = new ResultDatabase(this);
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          newCat = (Button) findViewById(R.id.bNewCat);
          newCat.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  // TODO Auto-generated method stub
                  Intent nextScreen = new Intent(getApplicationContext(),
                          CategoryList.class);
  
                  startActivity(nextScreen);
              }
          });
  
          ArrayList&lt;HashMap&lt;String, String&gt;&gt; todaytaskList = controller5
                  .getTodayTasks();
  
          if (todaytaskList.size() != 0) {
              ListView lv = getListView();
  
              lv.setOnItemClickListener(new OnItemClickListener() {
                  @Override
                  public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                          int position, long id) {
                      todaytaskId = (TextView) view
                              .findViewById(R.id.todaytaskId);
                      String valtaskId = todaytaskId.getText().toString();
                      Intent objIndent = new Intent(getApplicationContext(),
                              DelayTask.class);
                      objIndent.putExtra("todaytaskId", valtaskId);
                      startActivity(objIndent);
                  }
              });
  
              SimpleAdapter adapter = new SimpleAdapter(Main.this, todaytaskList,
                      R.layout.view_today_task, new String[] { "taskId",
                              "taskName", "taskTime" }, new int[] {
                              R.id.todaytaskId, R.id.todaytasktv,
                              R.id.todaytasktimetv});
              lv.setAdapter(adapter);
          adapter.notifyDataSetChanged();
          }
  
      }
  
  
  }
  </code></pre>
  
  <p>Here's my code to select tasks from ResultDatabase class</p>
  
  <pre><code>public ArrayList&lt;HashMap&lt;String, String&gt;&gt; getTodayTasks() {
      ArrayList&lt;HashMap&lt;String, String&gt;&gt; wordList;
      wordList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
      String selectQuery = "SELECT * FROM tasks where taskDate = date('now') AND taskDone = 'No'";
      SQLiteDatabase database = this.getWritableDatabase();
      Cursor cursor = database.rawQuery(selectQuery, null);
      if (cursor.moveToFirst()) {
          do {
              HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
              map.put("taskId", cursor.getString(0));
              map.put("taskName", cursor.getString(1));
              map.put("taskTime", cursor.getString(3));
              // map.put("taskDate", cursor.getString(4));
              wordList.add(map);
          } while (cursor.moveToNext());
      }
      return wordList;
  
  }
  </code></pre>