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

Reply via email to