I'm new to android and I just can't figure out how to make the actionbar work the way I want it to. I would like to click an item on my action bar that changes between the setContentView to different XML files.
I have the following XML files: activity_main_vertical_view.xml activity_main.xml
(Note that this is not so that I can see it in landscape mode, I'm aware of making a folder called layer-land. I want my xml file to be viewable horizontally in portrait mode which is why I'm trying to change XML).
I have a "change view" item in my actionbar which I'd like to make XMLs switch when I use it. However it's not working. What am I doing wrong?
I have 2 classes: MainActivity.java VerticalView.java
My Manifest.xml has the following code with respect to VerticalView
<activity
    android:name=".VerticalView"
    android:label="@string/title_activity_vertical_view" >
    <meta-data
        android:name="android.support.PARENT_ACTIVITY"
        android:value="com.example.calendar.activity_main" />
</activity>
My Menu for activity_main.xml has the following code:
<item
    android:id="@+id/change_view"
    android:onClick="changeView"
    android:orderInCategory="100"
    android:showAsAction="never"
    android:title="@string/change_view" >
</item>
my MainActivity.java has the following code:
    public class MainActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    public void changeView(View view) {
        Intent intent = new Intent(view.getContext(), VerticalView.class);
        startActivity(intent);
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}
Finally, my VerticalView.java has the following code:
public class VerticalView extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_vertical_view);
    }
}