Search code examples
androidorientationlandscapeportrait

how to load different xml file in orientation change in android


can anybody tell how to load different xml file whenever user changes device orientation in android?

For example, I am using a profile screen in my application. In portrait mode, user gives 'user name' value, after that I change orientation to landscape, now I have to load different xml, so that user gives value in landsacpe mode.

Is it possible?

Thanks

Editor's Note: English doesn't seem to be his first language.


Solution

  • create two types of layout directories to handle orientation . layout-land layout-port put the xml with the same name in both the directory. if i have main.xml file then i have to put it in both directory.

    Thanks