title: How to show different layouts in one activity?
body: <p>I have a activity in that I need to change the layout.</p>
  
  <p>In the first layout I have four buttons to display and in the second I need a <code>GridView</code> to display images.</p>
  
  <p>I need to show the second layout in an <code>AsyncTask onPostExecute</code> method.</p>
  
  <p>For now, I'm trying to set two setContentViews, but I get the following exception: <code>ClassCastException</code> </p>
  
  <blockquote>
  <pre><code>    @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_focusarea);
                                  videoBtn.setOnClickListener(new View.OnClickListener() {
          public void onClick(View arg0) {
              new LoadFiles().execute();
          }
      });
      animateBtn.setOnClickListener(new View.OnClickListener() {
          public void onClick(View arg0) {
              new LoadFiles().execute();          
          }
      });
      pdfBtn.setOnClickListener(new View.OnClickListener() {
          public void onClick(View arg0) {
              new LoadPDFFiles().execute();           
          }
      });
  }
  </code></pre>
  </blockquote>
  
  <p>And in my postExecute i try like this</p>
  
  <blockquote>
  <pre><code>  protected void onPostExecute(String file_url) {
        pDialog.dismiss();    
        runOnUiThread(new Runnable() {
      public void run() {
          setContentView(R.layout.gallery); 
              girGridView=(GridView) findViewById(R.id.gridView1_bir);
              girGridView.setAdapter(new ImageAdapter(this));     
                  girGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          @Override
               public void onItemClick(AdapterView&lt;?&gt; arg0, View view, int position,long arg3) {
      Toast.makeText(getApplicationContext(), GridViewConfig.getResim_list().get(position), Toast.LENGTH_SHORT).show();   
      }
  });
                  }
      });
  </code></pre>
  </blockquote>