title: MockView cannot be cast to android.view.ViewGroup
body: <p>I'm creating a small little app but I'm getting the error "...MockView cannot be cast to android.view.ViewGroup" and no display is setting up. I'm trying to have a button that switches states and text when it's selected. Any help would be much appreciated.</p>
  
  <p>Main class:</p>
  
  <pre><code>package rechee.pro.sound;
  
  import android.app.Activity;
  import android.media.AudioManager;
  import android.media.MediaPlayer;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.ImageView;
  import android.view.View.OnClickListener;
  import android.widget.ImageButton;
  
  public class PrometheusSoundActivity extends Activity implements OnClickListener {
  
      ImageButton pressed;
      ImageButton not_pressed;
  
      private MediaPlayer mp;
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          setVolumeControlStream(AudioManager.STREAM_MUSIC);
  
           ImageButton pressed = (ImageButton) findViewById(R.id.pressed);
          pressed.setOnClickListener(this);
  
           ImageButton not_pressed= (ImageButton) findViewById(R.id.not_pressed);
          not_pressed.setOnClickListener(this);
  
         // View clickButton= findViewById(R.id.click_button);
         //clickButton.setOnClickListener(this);
      }
      int resId;
      public void onClick(View v) {
          if(pressed.isSelected()){
              resId= R.raw.sound;
              mp= MediaPlayer.create(this, resId);
              mp.start();
  
  
  
          }
          if(not_pressed.isSelected()){
              mp.stop();
          }
  
          if(mp!=null){
              mp.release();
          }
  
  
  
      }
  }
  </code></pre>
  
  <p>XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" &gt;
  
  
  
      &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_height="wrap_content"
          android:layout_width="fill_parent"
          android:background="@drawable/promethus"&gt;
          &lt;item android:id="@+id/not_pressed"
              android:state_pressed="false"
              android:text="@string/Click"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"/&gt;
          &lt;item android:id="@+id/pressed"
              android:state_pressed="true"
              android:text="@string/stop_button"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"/&gt;
          &lt;/selector&gt;
  
  
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Strings xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources&gt;
  
      &lt;string name="hello"&gt;Hello World, PrometheusSoundActivity!&lt;/string&gt;
      &lt;string name="Click"&gt;Click here&lt;/string&gt;&lt;string name="stop_button"&gt;Stop&lt;/string&gt;&lt;string name="app_name"&gt;Prometheus Sound&lt;/string&gt;
  
  
  
  &lt;/resources&gt;
  </code></pre>