Skip to content Skip to sidebar Skip to footer

How To Connect Multiple Xml Files

My app needs different screens and each screen should be connected with each other. For example there are 5 screens, the main screen, 4 other screens connected to the main screen.

Solution 1:

You can also use and tag in your main.xml file to include other xml files....

http://developer.android.com/training/improving-layouts/reusing-layouts.html


Solution 2:

You can use ViewFlipper. You just have to add all layouts to your main layout. And then you can go in your MainActivity.java through all layouts. >ViewFlipper< But thats an older version of going through the views.

A nicer and more up to date method is using Fragments >Fragments<

Fragements Tut 1

Fragments Tut 2

Fragments Tut 3

There are many other tutorials and examples. Just google for "Android fragments Tutorial/example"


Solution 3:

use <include/> in your main xml to include other xmls in your layout.
OR
Use fragments.


Post a Comment for "How To Connect Multiple Xml Files"