title: Get ListView Height after setadapter
body: <p>well, I'm trying to get my listview height after I change it data, but it always return the prior height, not the actual.</p>
  
  <p>So when I set the setadapter, and it get the old value.
  e.g: </p>
  
  <pre><code> ActualHeight = 100
   Change data (filter) -&gt; NewHeight = 60
   ListView.GetHeight still returns 100.
  
   Again
  
   ActualHeight = 60
   Change data (filter) -&gt; NewHeight = 20
   ListView.GetHeight still returns 60.
  </code></pre>
  
  <p>The code i'm using is it:</p>
  
  <pre><code>                    int width, height = 0;
  
                      EditText edt_search;
                      ListView lv_marca;
  
                      List&lt;Marca&gt;  list_marca        = new ArrayList&lt;Marca&gt;();
                      List&lt;Marca&gt;  list_marca_search = new ArrayList&lt;Marca&gt;();
  
                      String text = edt_search.getText().toString(); 
  
  
                      list_marca_search.clear();
  
                      if(text.startsWith(".")){
                          text = text.replace(".", "");
                          for (Marca m : list_marca) {
                              if (String.valueOf(m.getCd_marca()).equals(text)){
                                  list_marca_search.add(m);
                              }
                          }
                      } else {
                          for (Marca m : lista_marca) {
                              if (m.getDs_marca().contains(text)){
                                  list_marca_search.add(m);
                              }
                          }
                      }
  
                      ArrayAdapter&lt;Marca&gt; adapter_marca = new CustomAdapter_Marca(MyDialog.this, R.layout.layout_consulta_estoque_marca_lista, list_marca_search);
  
                      lv_marca.setAdapter(adapter_marca);
  
                      int height_window  = getWindowManager().getDefaultDisplay().getHeight();
                      height             = lv_marca.getHeight() + getSupportActionBar().getHeight();
  
                      if (height &gt;= height_window) {
                          height = (int) (height_window * 0.95);
                      }
  
                      getWindow().setLayout(width, height);
  </code></pre>