I have an app that I can run in either landscape or portrait mode.  The 
user can also disable landscape mode on tablets.  On phones it runs in 
portrait only.

On startup, it logs into a server.  While doing so, it displays status 
messages by updating a textview.  What I see on the N7 in portrait mode:

1) ghosting of the textview as the text is updated multiple times. eg:   
Activity 1 copy 1:   TextA -> TextB ... but Activity 1 copy 2 still has it 
as TextA... so it refreshes back to TextA, then Activity 1 copy 2 updates 
TextA->TextB
2) When quitting the app, in portrait mode, it quits when I hit the back 
button.  In landscape mode, hitting the back button plays the quit 
animation, the window closes and then Activity 1 copy 2 is left still 
running.

The exact same activity code runs in both cases... 

Layout detection is done as follows:

    public static boolean isTabletMode(Context context) {
        SharedPreferences sharedPrefs = 
context.getSharedPreferences("WordHero", Activity.MODE_PRIVATE);
        Boolean phoneMode = sharedPrefs.getBoolean("forcePhoneMode", false);
        
        return ((context.getResources().getConfiguration().screenLayout & 
Configuration.SCREENLAYOUT_SIZE_MASK) >= 
Configuration.SCREENLAYOUT_SIZE_LARGE)
                && !phoneMode;
    }

Then I do the following:

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (isTabletMode(this))
            
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        else
            
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.splashscreen);


Some more data:  this only happens when the app is run in landscape mode, 
but initially held in portrait mode.  ie:  the initial screen is held in 
portrait.  You do not need to physically rotate the screen to trigger this 
(ie: still happens when run in landscape, but held in portrait!).

This is happening on JB 4.1.2 on a Nexus 7, but NOT on a Nexus S running JB 
4.1.2 (because the default OS never runs in portrait mode).

Can anyone tell me how to fix this ?  Thanks !

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to