title: Android listview disappears after screen rotation
body: <p>On my layout, I have some buttons tho make some choices and then one button to perform a query to a database. The result of this query is shown in a <code>ListView</code> inside this layout.</p>
  
  <p>The problem is if after I perform the query I rotate the screen, the <code>ListView</code> disappears and have to perform the query again.</p>
  
  <p>I believe that this is happening because the activity restarts. Following the suggestions <a href="https://stackoverflow.com/questions/456211/activity-restart-on-rotation-android">here</a> I've added to my activity in the manifest <code>android:configChanges="orientation|keyboardHidden"</code> and in my code added:</p>
  
  <pre><code>    @Override
      public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        setContentView(R.layout.mylayout);
  
      }
  </code></pre>
  
  <p>But this is not working.</p>
  
  <p>Here is the complete code of my activity:</p>
  
  <pre><code>public class MyClass extends ListActivity implements OnClickListener, OnCheckedChangeListener {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.mylayout);
  
          // Creates the buttons and setOnClickListener and setOnCheckedChangeListener
      }
  
      @Override
      public void onClick(View v) {
  
          // Manages the buttons and their functions
  
      @Override
      public void onCheckedChanged(RadioGroup group, int checkedId) {
          // See what group in radio group is checked
      }
  
      @Override
      protected void onListItemClick(ListView l, View v, int position, long id) {
          // After pressing one button, a query is made and a listview is shown. 
          // This it to handle the user choice after he clicks an item on the listview
  
      }
  
      @Override
      public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        setContentView(R.layout.mylayout);
  
      }
  }
  </code></pre>
  
  <p>This is strange because I have some other activity like this:</p>
  
  <pre><code>public class AtoZ extends ListActivity {
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.atoz);
  
  
  
      }
  
      @Override
      protected void onListItemClick(ListView l, View v, int position, long id) {
          // TODO Auto-generated method stub
          super.onListItemClick(l, v, position, id);
  
      }
  
  }   
  </code></pre>
  
  <p>This also performs a query to the database, shows it on a <code>ListView</code> and then handles the user choice. If I rotate the screen, <code>ListView</code> still shows.</p>
  
  <p>What can I do?</p>