Alex Zaitsev
Alex Zaitsev

Reputation: 1781

android layout-land and layout-port issue

I have layout folder with a layout for portrait orientation and layout-land folder with the layout for landscape orientation.
Now such situation: I start app in portrait orientatin - ok, right layout, change orientation - ok, landscape layout, again change orientation - and .. orientation is changed but layout is landscape..
What is it?

EDITED:
code:

private TextView mTxtGoDate;
private TextView mTxtGoBackDate;
private TextView mTxtCityFrom;
private TextView mTxtCityWhere;

private TextView mTxtManCount;
private TextView mTxtChildCount;
private TextView mTxtBabyCount;
private TextView mTxtClass;

private CheckBox mCheckOneWay;
private CheckBox mCheckRange;

private RelativeLayout mLayoutGoBack;

private Button mBtnSearch;

private SearchParams mSearchParams;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_new_search);

    mSearchParams = new SearchParams();

    mTxtGoDate = (TextView) findViewById(R.id.txt_go_date);
    mTxtGoDate.setOnClickListener(this);
    getDateGo();
    mTxtGoDate.setText(mSearchParams.getGoDate().getDateAsString());

    mTxtGoBackDate = (TextView) findViewById(R.id.txt_go_back_date);
    mTxtGoBackDate.setOnClickListener(this);
    getDateGoBack();
    mTxtGoBackDate.setText(mSearchParams.getGoBackDate().getDateAsString());

    mTxtCityWhere = (TextView) findViewById(R.id.txt_where_city);
    mTxtCityWhere.setOnClickListener(this);
    mTxtCityFrom = (TextView) findViewById(R.id.txt_from_city);
    mTxtCityFrom.setOnClickListener(this);

    mCheckOneWay = (CheckBox) findViewById(R.id.check_one_way);
    mCheckOneWay.setOnCheckedChangeListener(this);
    mCheckRange = (CheckBox) findViewById(R.id.check_correct);

    mLayoutGoBack = (RelativeLayout) findViewById(R.id.layout_go_back);
    ((LinearLayout) findViewById(R.id.params_layout)).setOnClickListener(this);
    mTxtManCount = (TextView) findViewById(R.id.param_man);
    mTxtChildCount = (TextView) findViewById(R.id.param_child);
    mTxtBabyCount = (TextView) findViewById(R.id.param_baby);
    mTxtClass = (TextView) findViewById(R.id.param_class);

    mBtnSearch = (Button) findViewById(R.id.btn_search_flightes);
    mBtnSearch.setOnClickListener(this);

    CitiesDataSource dbCities = new CitiesDataSource(this);
    dbCities.open();
        City from = dbCities.getLatestCity(true);
        City where = dbCities.getLatestCity(false);
        if (from != null) {
            mTxtCityFrom.setText(from.getName());
            mSearchParams.setFrom(from);
        }
        if (where != null) {
            mTxtCityWhere.setText(where.getName());
            mSearchParams.setWhere(where);
        }
    dbCities.close();
}

@Override
public void onResume() {
    super.onResume(false);
}

onResume in superclass:

protected void onResume(boolean flag) {
        super.onResume();
    }

the other code is unrelated to my question. thanks

Upvotes: 2

Views: 1349

Answers (1)

devunwired
devunwired

Reputation: 63293

Do you have any special tags in the manifest element for this Activity, such as configChanges that might complicate how it selects its resources?

You might also try putting the portrait layout in the default directory, and only have a qualified directory for the landscape layout, i.e.

layout/
    //Your portrait (default) layout
layout-land/
    //Your landscape layout overrides

Upvotes: 3

Related Questions