2

I have checked every possible solutions in all stack overflow solutions and other web sites also but no luck.

My Requirement is :

Phone - only portrait mode

Tablet - portrait and landscape mode.

So tried using following:

For finding device if it is a Phone or a Tablet I used

if (getResources().getBoolean(R.bool.is_sw_600dp_size)) {

    intent = new Intent(LauncherEmptyActivity.this, SplashActivityTablet.class);
    
} else {

    intent = new Intent(LauncherEmptyActivity.this, SplashActivity.class);
}

And for my requirement if I set orientation as following for all activities (all orientation set at Manifest, tried also through programming but no luck)

  1. LauncherEmptyActivity - Set Sensor

                        (or Set any of these above -  "nosenser", "userSensor", "unspecified", "fullUser", "user")
    
  2. SplashActivity - Set Portrait

  3. SplashActivityTabet - Same As LauncherEmptyActivity

Result :

  • Application open in both portrait and landscape mode in Tablet (Expected O/P)

  • But for Phone If it is held in landscape mode then - SplashActivity will be landscape for brief moment and then it will be in portrait (This is the issue and I dont want that for brief moment).

Issue happens in

  • Device - Nexus 5x (Nought),

  • Emulator - Google Pixel (Oreo)

But working fine in Device - Moto G4 Plus (Nought)

This is for more explanation purpose, Following solution perfectly fine If my requirement is

(working fine for all above devices mentioned)

Phone - only portrait

Tablet - only landscape

  1. LauncherEmptyActivity - Set Portrait

  2. SplashActivity - Set Portrait

  3. SplashActivityTablet - Set landscape

(all orientation set at Manifest)

Result : Correct As Expected

Community
  • 1
  • 1
  • Please guys, I have this issue and If you are giving minus marking then at least mention the reason for that in comments, because this problem is real and I am facing it, And If any more info require then let me know – AndroidDevloper Sep 27 '17 at 08:24

0 Answers0