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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:26:26+00:00 2026-06-12T09:26:26+00:00

I would like my Android app to instantiate it’s home screen activity one time

  • 0

I would like my Android app to instantiate it’s home screen activity one time only. I am managing the back stack appropriately to achieve this but have just discovered an orientation issue when the app starts up.

Visually this orientation change only shows itself on the emulator. (probably runs too fast to be observed on a device).

Here’s what happens :: –>

activity.onCreate()
activity.onDestroy()
activity.onCreate()

This sequence makes sense and is caused by the change in orientation. What does not make sense (to me) is that it happens at all because I have done the following to prevent an orientation change :: –>

AndroidManifest.xml contains

android:screenOrientation="portrait"

for all my activities and in the home screen activity onCreate() method, I’m calling

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

So why do I get an orientation change?

  • 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-12T09:26:26+00:00Added an answer on June 12, 2026 at 9:26 am

    Add android:screenOrientation="portrait" in your manifest file where you declare your activity like this

    <activity android:name=".yourActivity"
              ....
              android:screenOrientation="portrait"/>
    

    if you want to do using java code
    try

    setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 
    

    before you setContentView for your activity in onCreate()

    see here

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

Sidebar

Related Questions

I would like to implement the following simple pattern in an android app: Activity
I would like my android app service to run all the time. that is
I would like to create an activity with layout like has Google+ Android App
I would like my android app to be only available online. If user has
I would like to produce 2 builds of my Android app: one build which
I would like to crash my Android app by using command-line ADB tool during
I would like to do two things within my Android app : Check if
I would like to make a single Android app for multiple Android versions (possibly
I would like to create a custom control in my Android App. It will
I'm working on an Android app in which I would like to use multi-touch.

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.