Even i had the same problem when running the code in gingerbread. But works fine for ICS. The solution is,
instead of this:
public class MainActivity extends Activity {
}
use extends FragmentActivty
public class MainActivity extends FragmentActivity {
}