Android Multi-Screen Application

jay picture jay · Apr 7, 2011 · Viewed 20.2k times · Source

How do you handle multiple screens in an android application? I have developed with the tab bar at the bottom without problem, however what I am wanting to do is replace all the content on the screen with the content from a new .xml layout file I have created in the project. Additionally, how would I tie the back end code to the new layout file? I'm sure this question probably exists already and is googleable (may have made up a new word). However, I don't know exactly what it is that I am looking for. Thanks in advance for your help.

Answer

Tommy picture Tommy · Apr 7, 2011

What you need to do is, create a new Activity and add it to the AndroidManifest.xml:

<activity android:name="ActivityClassName" android:label="Label for the Activity"></activity>

and can be called in a method:

public void startActivity() {
    Intent someName = new Intent(CurrentClass.this, ActivityClassName.class);
    startActivity(someName);
}