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

  • Home
  • SEARCH
  • 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 7190905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:36:59+00:00 2026-05-28T19:36:59+00:00

I want my splash activity to support both vertical and horizontal orientation. The code

  • 0

I want my splash activity to support both vertical and horizontal orientation.

The code for splash activity is as follows

public class Splash extends Activity{

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);

    Thread timer = new Thread(){
        public void run() {
            try{
                sleep(5000);    

            }catch(InterruptedException e){
                e.printStackTrace();
            }finally{
                Intent ARCActivityIntent = new Intent("com.ex.rc.LISTSCREEN");
                startActivity(ARCActivityIntent);// 
                finish();
            }
        }};

    timer.start();

    }

}

Code of splash.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|center_vertical"
    android:background="@drawable/splash_bg"
    >
</LinearLayout>

But the problem is – LISTSCREEN activity is re-created number of times the orientation is changed.

Help me.

  • 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-28T19:37:00+00:00Added an answer on May 28, 2026 at 7:37 pm

    I was having a similiar problem. I got it fixed. Here is the solution.
    Create only one layout for splash screen, but create different images for LANDSCAPE and PORTRAIT. As you have only one layout i.e portrait, the activity would not be re-created. But background image would change providing the effect of orientation change.

    Write down the following code in onCreate.

    setContentView(R.layout.splash);
    
    splashImage = (ImageView) findViewById(R.id.splash_img);
    
    int orient = getWindowManager().getDefaultDisplay().getOrientation();
    if (orient == 0) {
             splashImage.setBackgroundResource(R.drawable.splash_portrait);
    } else {
             splashImage.setBackgroundResource(R.drawable.splash_landscape);
    }
    

    Override onConfigurationChanged method

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
    
        int orient = getWindowManager().getDefaultDisplay().getOrientation();
        if (orient == 0) {
            splashImage.setBackgroundResource(R.drawable.splash_portrait);
        } else {
            splashImage.setBackgroundResource(R.drawable.splash_landscape);
        }
    }
    

    SplashActivity in manifest should look like this

        <activity
            android:name="SplashActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class hello extends Activity, ListActivity { WebView main_webv; ListView main_listv; public static final
I only want a simple Splash Screen Example. Get the Code, Insert my picture,
I want to implement a splash screen for my app, i'm using this code
I have a main class and a splash screen. the splash doesn't want to
I want a splash screen to show while the application is loading. I have
I want to make a splash screen, which cannot be clicked/selected by mouse/UI. As
I want to play a sound while my splash screen gets data from the
in my js file i want to be able to load a splash screen
I still have a problem with the splash screen. I don't want to use
The first activity in my app is a splash screen with a Progress Dialog

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.