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 6932645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:43:55+00:00 2026-05-27T11:43:55+00:00

When i changed screen from portrait mode to land scape mode then automatically came

  • 0

When i changed screen from portrait mode to land scape mode then automatically came out from my application.(same as landscape to portrait also)can any one tell me the solution for this..

this is my code for orientation,

if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
            Toast.makeText(MyAlphabetsActivity.this, "ORIENTATION_PORTRAIT",
                    Toast.LENGTH_SHORT).show();
            setContentView(R.layout.portrait_main);
            System.out.println("int-----1--");
        } else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
            setContentView(R.layout.landscape_main);
            Toast.makeText(MyAlphabetsActivity.this, "ORIENTATION_LANDSCAPE",
                    Toast.LENGTH_SHORT).show();
            System.out.println("int-----2--");
        }

when change portrait to landscape control entered into else if() and display Toast massage also…….

  • 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-05-27T11:43:55+00:00Added an answer on May 27, 2026 at 11:43 am

    If you have same layout in portrait as well as in the landscape mode then its better to stop the re-creation of Activity on rotation change by adding

    android:configChanges="orientation|keyboardHidden"
    

    attribute in your activity tag in the Manifest file.

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

Sidebar

Related Questions

I created New Project -> Tab Bar Application. Then i changed from @interface FirstViewController
As usual in android, each time the screen is flipped to portrait/landscape mode an
I am developing an application with orientation support for both portrait and landscape mode.
BACKGROUND I am writing a screen capture application My code is based derived from
I want to change my blackberry screen GUI When i go from portrait to
I would like to change the orientation of my SurfaceView from landscape to portrait.
I have two views one of them is in landscape and other in portrait.
I'm developing a data-driven application using Core Data. I display the tables from the
I need to keep my Activity's layout in portrait mode but still get notified
ok i am having real troubles with screen orientation. My application has a countdown

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.