Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8033079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:35:11+00:00 2026-06-05T01:35:11+00:00

I am developing an application according to this example . I defined a landscape

  • 0

I am developing an application according to this example. I defined a landscape layout for header.xml in a layout-land folder, but when I change the orientation to landscape, defined layout does not appear in the screen.

Do know Why ?

Thanks

Updated :

Activity Code :

public class ACENewsFeedActivity extends ListActivity {

    // Progress Dialog
    private ProgressDialog pDialog;

    // Array list for list view
    ArrayList<HashMap<String, String>> rssItemList = new ArrayList<HashMap<String,String>>();

    RSSParser rssParser = new RSSParser();

    List<RSSItem> rssItems = new ArrayList<RSSItem>();

    RssFeed rssFeed;

    private static String TAG_TITLE = "title";
    private static String TAG_LINK = "link";
    private static String TAG_DESRIPTION = "description";
    private static String TAG_PUB_DATE = "pubDate";
    //private static String TAG_GUID = "guid"; // not used

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.rss_item_list);

        /**
         * Calling a backgroung thread will loads recent articles of a website
         * @param rss url of website
         * */
        new loadRSSFeedItems().execute();
       }

       ....
}

XMl Layout in landscape mode :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/layoutHeader"
    android:layout_width="fill_parent"
    android:layout_height="50dip"
    android:layout_alignParentTop="true"
    android:background="@layout/header_gradient"
    android:orientation="horizontal">

    <!-- Logo -->

    <!-- Refresh -->


    <!-- Plus Button -->

    <ImageButton
        android:id="@+id/btnAddSite"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_marginRight="5dip"
        android:background="@null"
        android:src="@drawable/plus"
        android:layout_centerVertical="true" />

    <ImageView
        android:id="@+id/logo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:src="@drawable/logo" />

    <ImageView
        android:id="@+id/refreshList"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:src="@drawable/refresh" />

</RelativeLayout>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:35:13+00:00Added an answer on June 5, 2026 at 1:35 am

    Android allows you to provide different versions of resource files to support specific device configurations including screen size/resolution and (as you are trying to do) device orientation. When android is loading a layout file it will look first in the res/layout-port folder (if it is in portrait orientation) or in the res/layout-land folder (if it is in landscape orientation). If it doesn’t find the file it will then look in the regular res/layout folder.

    Additionally, as noted here, when certain device configurations change (like device orientation) during runtime android will restart whatever process is currently running by saving the state, destroying it, and then starting it with the saved state info. This allows it to load the layout files again, and it will look it the folder for the new orientation when it tries to load them.

    So, if you start your application in portrait it will load the file in res/layout-port or res/layout. If you then rotate the device to landscape it will destroy your process and restart. However, this time it will be in landscape so it will check res/layout-land instead for the layout files.

    If you have your files set up this way but it is not operating as you think it should, I’d first verify that it is definitely not using the correct files by putting two different header.xml files in the layout-land and layout-port folders, maybe one with a red background and one with a green background. Make sure to double-check the file references and maybe use Toast to post some debugging info on-screen to ensure that it is inflating layouts properly.

    The default behavior is for android to handle the orientation change (which involves destroying your activity and creating a new instance of it which will reload all layout files). This default behavior will always occur unless your activity tag in your manifest file contains the property android:configChanges="orientation". (This tag can take arguments other than orientation – android will handle the config changes for all events except the ones you pass as arguments to this tag.)

    If you include the android:configChanges="orientation" tag you are telling android NOT to destroy your activity and NOT to reload layout files when the orientation of the device changes. Instead of its default behavior it will call a method (which you define) to allow you to make any changes you wish to make to handle the orientation change yourself rather than letting android handle it automatically. It’s intended so that if destroying your activity would be a major inconvenience it doesn’t have to be automatically destroyed.

    EDIT: added some things from the comment discussion

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’m developing application with JBoss AS 5 with a special configuration according to my
I'm developing application which need access to user's facebook account. It is working, but
I am developing application which is having Gujarati font in text-view but my problem
I'm developing wp7 Mango application. I run PeriodicTask and want to notify user according
I am developing an application which displays multiple views as tables (for example customers,
I'm developing some third-party application for Sina Weibo, but have something made me really
I'm currently developing an iPad application that integrates MapKit. But I have a small
Hi i'm having problems with this. I am developing an asp.net mvc 2 application.
I am developing a web application and now I need to make this application
I am developing an application which posts videos to Facebook. I have registered this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.