title: ListView doesn't refresh on notifyDataSetChanged
body: <p><code>ListView</code> doesn't seem to refresh when <code>notifyDataSetChanged();</code> is called, but does refresh when its adapter gets set again.</p>
  
  <p>In my Activity <code>onCreate</code> I initialize my <code>ListView</code> and my adapter. Then I have this <code>Hanler</code> that checks for new values every second. <code>listview.setAdapter(arrayAdapter);</code> works but <code>arrayAdapter.notifyDataSetChanged();</code> doesn't do anything. </p>
  
  <p>Here is the code:</p>
  
  <pre><code>    public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
  
                       lv = (ListView) findViewById(R.id.listView1);
  
              arrayAdapter = new ArrayAdapter&lt;Integer&gt;(this,android.R.layout. simple_list_item_1, myIntegers);
              lv.setAdapter(arrayAdapter);
      }
  
      private Handler handler = new Handler() {
  
              @Override
              public void handleMessage(Message msg) {
                  if (msg.what == DIS){
                      handler.sendEmptyMessageDelayed(DIS, 1000);
                      if(!refresh()){
                          handler.removeMessages(DIS);
                      }
                  }
              }
          };
  
     public boolean refresh(){
  
          if(ports.isEmpty()){
              return false;
          }else{
              listview.setAdapter(arrayAdapter); //WORKS
      arrayAdapter.notifyDataSetChanged(); // DOESN'T WORK
              return true;
              }
      }
  </code></pre>
  
  <p>So I was wondering how to make that work with <code>notifyDataSetChanged</code>, because I read that it is the right way to do it, and anyway even if the <code>setAdapter</code> does work it makes my listview jump to beginning every time it refreshes it.</p>
  
  <p>EDIT:</p>
  
  <p>To clarify things, I am adding more values to myIntegers.</p>