But why -large qualifier doesn't work well on nexus7? I am using different layout for portrait and landscape mode on nexus7. If I use -sw600dp and -w720dp to tell detect the case, I guess the layout defined in -sw600dp will take the precedence over -w720dp even in landscape mode according to Android doc, right?
On Monday, October 29, 2012 7:49:16 AM UTC-7, Streets Of Boston wrote: > > For nexus7, use the *sw600dp* instead of *large*. > > http://android-developers.blogspot.com/2012/07/getting-your-app-ready-for-jelly-bean.html > > > On Saturday, October 27, 2012 2:45:24 PM UTC-4, Lili Deng wrote: >> >> I am working on adding tablet support on an app. To identify tablet or >> phone, I try to rely on a boolean value defined in resource of different >> bucket, like: >> -values >> >> bool.xml >> >> <resources> >> >> <bool name="isPhoneLayout">true</bool> >> >> </resources> >> >> -values-large >> >> bool.xml >> >> <resources> >> >> <bool name="isPhoneLayout">false</bool> >> >> </resources> >> >> >> And then, I have check in code like: >> if (getResources().getBoolean(R.bool.isPhoneLayout)) { >> //start activity for phone >> } >> else { >> //start activity for tablet >> } >> >> The app support sdk v8-v15 and my test device is Nexus7 with 4.1.2. The >> code works most of time, but occasionally wrong activity got loaded, and I >> can see that getResources().getBoolean(R.bool.isPhoneLayout) returns true >> in debugger when that happens. The problem can be fixed by rotating screen. >> However, I don't have exact repro steps for the problem. >> >> Any thoughts on this? Is the right approach to detect phone/tablet? >> Should I check something like getResources().getConfiguration() instead? >> >> 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

